这是一个常见错误,但在这种情况下不知道如何解决这个问题。我做了什么:
cordova build android
然后它返回:
$ cordova build android
Running command: "/app/platforms/android/cordova/build"
ANDROID_HOME=/Android SDK/adt-bundle-mac-x86_64-20140702/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
Running: /app/platforms/android/gradlew cdvBuildDebug -b /app/platforms/android/build.gradle -Dorg.gradle.daemon=true
:preBuild
:compileDebugNdk UP-TO-DATE
:preDebugBuild
:checkDebugManifest
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preDebugBuild
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:compileDebugJava UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:packageDebugJar UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:packageDebugJniLibs UP-TO-DATE
:CordovaLib:packageDebugLocalJar UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:compileLint
:com.phonegap.plugins.facebookconnect:FacebookLib:copyDebugLint UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeDebugProguardFiles UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:preBuild
:com.phonegap.plugins.facebookconnect:FacebookLib:preDebugBuild
:com.phonegap.plugins.facebookconnect:FacebookLib:checkDebugManifest
:com.phonegap.plugins.facebookconnect:FacebookLib:preDebugTestBuild
:com.phonegap.plugins.facebookconnect:FacebookLib:prepareAndroidCordovaLibUnspecifiedDebugLibrary
:com.phonegap.plugins.facebookconnect:FacebookLib:prepareDebugDependencies
:com.phonegap.plugins.facebookconnect:FacebookLib:compileDebugAidl
:com.phonegap.plugins.facebookconnect:FacebookLib:compileDebugRenderscript
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugBuildConfig
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugAssets UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeDebugAssets
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugResValues UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugResources
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeDebugResources
:com.phonegap.plugins.facebookconnect:FacebookLib:processDebugManifest
:com.phonegap.plugins.facebookconnect:FacebookLib:processDebugResources
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugSources
:com.phonegap.plugins.facebookconnect:FacebookLib:compileDebugJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:com.phonegap.plugins.facebookconnect:FacebookLib:processDebugJavaRes UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugJar
:com.phonegap.plugins.facebookconnect:FacebookLib:compileDebugNdk
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugJniLibs UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugLocalJar
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugRenderscript UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugResources
:com.phonegap.plugins.facebookconnect:FacebookLib:bundleDebug
:prepareAndroidComPhonegapPluginsFacebookconnectFacebookLibUnspecifiedDebugLibrary
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:preReleaseBuild
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:preReleaseBuild
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:compileReleaseJava UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:packageReleaseJar UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:packageReleaseJniLibs UP-TO-DATE
:CordovaLib:packageReleaseLocalJar UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:copyReleaseLint UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeReleaseProguardFiles UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:preReleaseBuild
:com.phonegap.plugins.facebookconnect:FacebookLib:checkReleaseManifest
:com.phonegap.plugins.facebookconnect:FacebookLib:prepareAndroidCordovaLibUnspecifiedReleaseLibrary
:com.phonegap.plugins.facebookconnect:FacebookLib:prepareReleaseDependencies
:com.phonegap.plugins.facebookconnect:FacebookLib:compileReleaseAidl
:com.phonegap.plugins.facebookconnect:FacebookLib:compileReleaseRenderscript
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseBuildConfig
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseAssets UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeReleaseAssets
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseResValues UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseResources
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeReleaseResources
:com.phonegap.plugins.facebookconnect:FacebookLib:processReleaseManifest
:com.phonegap.plugins.facebookconnect:FacebookLib:processReleaseResources
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseSources
:com.phonegap.plugins.facebookconnect:FacebookLib:compileReleaseJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:com.phonegap.plugins.facebookconnect:FacebookLib:processReleaseJavaRes UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseJar
:com.phonegap.plugins.facebookconnect:FacebookLib:compileReleaseNdk
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseJniLibs UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseLocalJar
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseRenderscript UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseResources
:com.phonegap.plugins.facebookconnect:FacebookLib:bundleRelease
:prepareComAndroidSupportSupportV42220Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAds810Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources
:processDebugManifest
:processDebugResources
:generateDebugSources
:compileDebugJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:preDexDebug
:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
:dexDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Android SDK/adt-bundle-mac-x86_64-20140702/sdk/build-tools/23.0.1/dx --dex --no-optimize --output /app/platforms/android/build/intermediates/dex/debug --input-list=/app/platforms/android/build/intermediates/tmp/dex/debug/inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 30.368 secs
/app/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /app/platforms/android/gradlew with args: cdvBuildDebug,-b,/app/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /app/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /app/platforms/android/cordova/build: Command failed with exit code 1
所以我理解这是android-support-v4和android-support-v13之间的版本冲突,但不知道如何解决这个问题。
$ cordova -v 5.4.0
$ cordova平台 安装平台:android 4.1.1,ios 3.8.0
提前致谢!
答案 0 :(得分:0)
我敢打赌它是引起碰撞的Facebook插件。尝试将其添加到platforms/android/build.gradle
文件中:
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}