构建ionic Android应用时出现Dex错误

6

我正在尝试为Android构建一个ionic应用程序,但是当我运行时

ionic cordova run android

I get

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: java.lang.IllegalStateException: Dex archives: setting .DEX extension only for .CLASS files

尝试运行./gradlew clean时,我遇到了以下问题:
FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type FileHasher using BuildSessionScopeServices.createFileSnapshotter().
1个回答

10

我曾经遇到同样的问题,但现已解决。感谢@notlose在这个链接https://github.com/oney/react-native-gcm-android/issues/32提供的信息。

解决方案:
只需删除/android/android/app中的'build'文件夹,然后使用下面的命令重新构建
对于react-native,请使用'react-native run-android'命令
对于ionic,请使用'ionic cordova run android'命令


1
至少对我来说,已经确认为解决方案。 - Steve

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接