我有一个Android应用程序,它最初是在Eclipse IDE和ADT上构建的。当新的FB SDK 4+问世时,应用程序已升级为仅在Eclipse中使用新的FB SDK。它运行正常。现在,我想在Android Studio中导入该应用程序。我已成功导入它并使用新的FB库作为模块按预期执行。
现在,我想以gradle在Android Studio中的方式更改FB库引用。我已按照this video和this article来实现目标。按照这些步骤后,我从项目中删除了FB模块。该项目没有显示其他错误,但每当我尝试运行它时,我都会收到如下错误:
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
我不确定导致此错误的原因,我已经清理了项目并尝试重建它,但它没有帮助。这是我在控制台中看到的唯一错误。
build.gradle文件:
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'
}
}
我哪里错了?为什么我在运行应用程序时遇到上述错误?