Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dex error when trying to build ionic Android app

I'm trying to build an ionic app for Android but when I run

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

Trying to run ./gradlew clean gets me

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().
like image 453
LAB Avatar asked Mar 05 '18 04:03

LAB


1 Answers

I had the same issue but it was resolved. Thanks to information from @notlose at this link https://github.com/oney/react-native-gcm-android/issues/32

Solution:
just remove both 'build' folder in /android and /android/app and build again with
'react-native run-android' for react-native
'ionic cordova run android' for ionic

like image 80
OPMat Avatar answered Oct 30 '22 17:10

OPMat