我正在尝试使用phonegap-androidstudio制作应用程序。当我尝试运行phonegap的index.html时,它显示17个错误和0个警告。
Compilation completed with 17 errors and 0 warnings in 20s 798ms Error:Android Dex: [android] Unable to execute DX Error:Android Dex: [android] com.android.dex.DexException: Multiple dex files define Lorg/apache/cordova/AuthenticationToken; Error:Android Dex: [android] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579) Error:Android Dex: [android] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535) Error:Android Dex: [android] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517) Error:Android Dex: [android] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164) Error:Android Dex: [android] at com.android.dx.merge.DexMerger.merge(DexMerger.java:188) Error:Android Dex: [android] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504) Error:Android Dex: [android] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334) Error:Android Dex: [android] at com.android.dx.command.dexer.Main.run(Main.java:277) Error:Android Dex: [android] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) Error:Android Dex: [android] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) Error:Android Dex: [android] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) Error:Android Dex: [android] at java.lang.reflect.Method.invoke(Method.java:497) Error:Android Dex: [android] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:161) Error:Android Dex: [android] at org.jetbrains.android.compiler.tools.AndroidDxRunner.main(AndroidDxRunner.java:294) Error:Android Dex: [android] at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:130)
如何解决这个问题?
答案 0 :(得分:0)
如果您/插件尝试多次实施Google服务,则会发生此错误。将这些行放在项目中Android文件夹的build.gradle(Module Android)文件中:
apply plugin: 'com.android.application'
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
all*.exclude group: 'com.google.android.gms', module: 'play-services'
}