Cordova构建了android错误:任务执行失败':dexDebug'

时间:2015-12-01 20:17:32

标签: android facebook cordova plugins

这是一个让我保持清醒的错误。我知道这是Android中的支持版本4的错误,但无法修复它。

这是我的插件

  

$ cordova plugin ls cc.fovea.cordova.purchase 3.11.0"购买"

     

com.google.playservices 19.0.0"适用于Android的Google Play服务"

     

com.phonegap.plugins.PushPlugin 2.4.0" PushPlugin"

     

com.phonegap.plugins.facebookconnect 0.11.0" Facebook Connect"

     

cordova-plugin-admobpro 2.9.9" AdMob Plugin Pro"

     

cordova-plugin-device 1.0.1" Device"

     

cordova-plugin-extension 1.2.2" Cordova Plugin Extension"

     

cordova-plugin-file-transfer 1.3.0"文件传输"

     

cordova-plugin-iad 2.0.5" iAd PluginPro"

     

cordova-plugin-inappbrowser 1.0.1" InAppBrowser"

     

nl.x-services.plugins.calendar 4.2.8" Calendar"

     

org.apache.cordova.camera 0.3.4"相机"

     

org.apache.cordova.file 1.3.2" File"

     

org.apache.cordova.media 0.2.15" Media"

     

org.apache.cordova.network-information 0.2.14"网络信息"

     

org.apache.cordova.splashscreen 0.3.5" Splashscreen"

     

uk.co.whiteoctober.cordova.appversion 0.1.5" AppVersion"

并且在cordova构建android之后这是错误

: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/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
    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/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/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
        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: 7.889 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

在app项目的build.grandle上我有这个

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    debugCompile project(path: "CordovaLib", configuration: "debug")
    releaseCompile project(path: "CordovaLib", configuration: "release")
    debugCompile project(path: "com.phonegap.plugins.facebookconnect:FacebookLib", configuration: "debug")
    releaseCompile project(path: "com.phonegap.plugins.facebookconnect:FacebookLib", configuration: "release")
    compile "com.google.android.gms:play-services-ads:+"
    // SUB-PROJECT DEPENDENCIES END
}

configurations {
    // to avoid double inclusion of support libraries
    all*.exclude group: 'com.android.support', module: 'support-v4'
}

如果我删除了facebook connect插件,则会显示其他错误

:preDexDebug
:dexDebug

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
    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:
    /Volumes/Macintosh HD/Documentos/Trabajo/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 Lcom/google/ads/AdRequest$ErrorCode;
        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: 14.86 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

但我发现的是解决不删除插件的问题。 提前致谢

1 个答案:

答案 0 :(得分:0)

我知道你正在寻找一个解决方案而不需要删除插件但是我在这里。尝试删除此插件" com.google.playservices 19.0.0"适用于Android的Google Play服务""。由于我认为Android sdk工具已经在您的PATH中,因此Google Play服务已经包含在内,并且无需将其添加为插件。试一试。