我正在研究使用android和离子框架的混合应用程序。我想使用google +功能添加登录信息,因此我使用了此cordova-plugin-googleplus
在使用此插件之前 npm run build_android 运行正常,没有任何错误,但安装此插件后会抛出这些错误输出 -
:dexArmv7Debug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
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)
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dexArmv7Debug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
D:\Projects\adt-bundle-windows-x86_64-20140702\sdk\build-tools\23.0.0\dx.bat --dex --no-optimize --output D:\Projects\wamp
\www\hybridapp\cordova\platforms\android\build\intermediates\dex\armv7\debug --input-list=D:\Projects\wamp\www\hybridapp\cordova
\platforms\android\build\intermediates\tmp\dex\armv7\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
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: 3 mins 29.39 secs
d:\Projects\wamp\www\hybridapp\cordova\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "d:\Projects\wamp\www\hybridapp\cordova\platforms\android\gradlew cdvBuildDebug -b
d:\Projects\wamp\www\hybridapp\cordova\platforms\android\build.gradle -Dorg.gradle.daemon=true"
ERROR building one of the platforms: Error: d:\Projects\wamp\www\hybridapp\cordova\platforms\android\cordova\build.bat: Command f
ailed with exit code 1
You may not have the required environment or OS to build this project
Error: d:\Projects\wamp\www\hybridapp\cordova\platforms\android\cordova\build.bat: Command failed with exit code 1
at ChildProcess.whenDone (c:\Users\pcs227\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\supers
pawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
我该如何解决?
编辑:这些是使用的插件列表:
com.phonegap.plugins.facebookconnect 0.11.0 "Facebook Connect"
cordova-plugin-crosswalk-webview 1.0.1-dev "Crosswalk WebView Engine"
cordova-plugin-googleplus 4.0.6 "Google+"
cordova-plugin-whitelist 1.0.0 "Whitelist"
org.apache.cordova.camera 0.3.6 "Camera"
org.apache.cordova.console 0.2.13 "Console"
org.apache.cordova.device 0.3.0 "Device"
org.apache.cordova.file 1.3.0 "File"
org.apache.cordova.file-transfer 0.5.0 "File Transfer"
org.apache.cordova.geolocation 0.3.12 "Geolocation"
org.apache.cordova.network-information 0.2.15 "Network Information"
org.apache.cordova.splashscreen 1.0.0 "Splashscreen"
答案 0 :(得分:0)
我遇到了同样的错误,当我们升级或安装新的android sdk时可能会发生这种情况。尝试卸载android平台:
ionic platform remove android
然后使用以下命令重新安装:
ionic platform add android