尝试构建离子Android应用时出现Dex错误

LAB*_*LAB 6 android gradle cordova ionic-framework

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

ionic cordova run android
Run Code Online (Sandbox Code Playgroud)

我明白了

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
Run Code Online (Sandbox Code Playgroud)

试着运行./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().
Run Code Online (Sandbox Code Playgroud)

OPM*_*Mat 10

我有同样的问题,但它已经解决了.感谢来自@notlose的信息,请访问此链接https://github.com/oney/react-native-gcm-android/issues/32

解决方案:
只需删除/ android/ android/app中的'build'文件夹, 然后使用 ' react-native run-android ' 再次构建反应原生 ' 离子cordova运行android '用于离子