Reputation: 481
I've been struggling with this problem for 2 days. I can't debug my application on my android device using Android Studio.
This is the error I get:
[INSTALL_FAILED_DEXOPT]
When I look at the logs, it says "zip archive does not include classes.dex"
So the problem is that classes.dex isn't being built into the APK. This is true since the file size of my APK is now around 1MB whereas it used to be around 1.3MB.
I have tried everything, but I have no idea why classes.dex isn't being built into my APK. Any help is greatly appreciated.
Joaquin
Upvotes: 1
Views: 1382
Reputation: 126
Note that classes.dex is only generated if your project contains Java classes. So if you are using the NDK in combination with native activities, there won't be no Java code at all and therefore no classes.dex. In that case, you have to set the hasCode attribute in the manifest to false because otherwise dexopt will be looking for it.
http://developer.android.com/guide/topics/manifest/application-element.html#code
Upvotes: 0
Reputation: 702
I just tried disabling my antivirus (Avast), cleaning and rebuilding the app and then restarting Android Studio.
Those steps worked and I can now debug my application on my android device again.
Upvotes: 0
Reputation: 103
Try cleaning your build, and build the app again.. Make sure you've added the activities to the Android manifest. Once you get the apk use 7zip to view apk and check if there is classes.dex or use native zip viewer if on Linux. And if nothing still works try synchronizing the build files so that gradle can detect non ide changes.
Upvotes: 1