0
votes

it's an error that keep me awake. I know that is an error with the support version 4 in android but can't fix it.

This are my plugins

$ cordova plugin ls cc.fovea.cordova.purchase 3.11.0 "Purchase"

com.google.playservices 19.0.0 "Google Play Services for Android"

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 "File Transfer"

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 "Camera"

org.apache.cordova.file 1.3.2 "File"

org.apache.cordova.media 0.2.15 "Media"

org.apache.cordova.network-information 0.2.14 "Network Information"

org.apache.cordova.splashscreen 0.3.5 "Splashscreen"

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

and after cordova build android this is the error

: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

on the build.grandle of the app project I have this

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'
}

if I remove the facebook connect plugin it shows an other error

: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

But what i'm finding is to solve the bug not to remove plugins. Thanks in advance

1

1 Answers

0
votes

I know you are looking for a solution without removing plugins but here me out. Try removing this plugin "com.google.playservices 19.0.0 "Google Play Services for Android"". As I assume android sdk tools is already in your PATH therefore Google Play Service is already included and there is no need to add it as a plugin. Give it a try.