I have an android application which was originally built on Eclipse IDE along with ADT. When the new FB SDK 4+ came out, the app was upgraded to use the new FB SDK in Eclipse only. It was running fine. Now, I wanted to import the application in Android Studio. I had imported it successfully and it executed as expected using the new FB Library as a module.
Now, I wanted to change the FB library referencing in the way gradle does in Android Studio. I have followed this video and this article for achieving the goal. After following the steps, I have removed the FB modules from my project. The project shows no other error, but whenever I try to run it, I get an error like:
Error:Execution failed for task ':xxxx xxxx:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 2
I am unsure about what is causing this error, I have cleaned the project and also tried to rebuild it, but it did not help. This is the only error I can see in the console.
The build.gradle file:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
repositories {
mavenCentral()
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':Viewpage:viewpage-library')
compile project(':CountryPicker')
compile project(':google_play_services:libproject:google-play-services_lib')
compile project(':numberpicker-library')
compile project(':numberpicker-library')
compile project(':CountryPicker')
compile project(':Viewpage:viewpage-library')
compile project(':google_play_services:libproject:google-play-services_lib')
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
}
}
Where am I going wrong? Why I am getting the above mentioned error while running the app?