Failure to install APK [INSTALL_FAILED_DEXOPT] Android Studio - android

I have tried literally everything to try and rectify this error when trying to deploy an app to an actual android device for debugging but have been unable to solve the matter. Everytime I try to launch I get a failed [INSTALL_FAILED_DEXOPT] error and when checking the logcat it is always because there is no classes.dex in my debug apk.
If I run gradlew.bat clean assembleDebug, there is no difference in the apk size so I'm assuming there is a build error in android studio. I am using android studio beta 0.86 and have tried it on 0.89 with the same result. I have tried build tools for 19.1 to 21 with no result. I have also tried different devices and created a new project (that has never been installed on my devices) and android studio seems to think it needs to be uninstalled first when attempting to deploy.
I have tried switching my device to ART, uninstalling and reinstalling android studio, redownloading the sdk and restarting my computer. NOTHING and I mean NOTHING has worked. I think the problem started after I downloaded the lollipop apis but am not sure. I have tried uninstalling all apps with my package signature on my device but NOTHING works! Not even Project -> Clean Project -> Rebuild
This is extremely frustrating as I cannot debug my apps anymore :/ has anyone had any experience with this error or ways to rectify it?

So turns out that the issue was mismatching sdks between Android Studio and the Project. The project was using an old sdk and once I made them the same, I cleaned and rebuilt the project and everything was good to go.
UPDATE:
I ran into the problem again after I tried to update my SDK and its tools. Turns out that when you try to do this, the SDK locks the tools folder and then you get an error saying some file couldn't be overridden. When this happened to me, all the build tools were deleted so there were errors in the .dex file created when debuggin my app.

We are using android 2.2 (really old i know) and couldn't find a fix for this error. Eventually we found this bug https://android-review.googlesource.com/#/c/30900/. The only solution for us was to remove some libraries...

I kept having the same problem - manually building worked fine, but Android Studio would not build a proper APK.
The problem was that I started the project on Android Studio and Android Gradle plugin version 2.0-beta2. After updating the Gradle plugin to 2.0-beta6 through a simple build.gradle change, the builds stopped working.
Turns out that, although I installed a beta version of Android Studio, the update checker only checked the stable channel. After setting the updater to check the canary channel as well, I was able to upgrade Android Studio to version 2.0-beta6 and builds continued to work normally.
You can change the update preference in Android Studio settings under Appearance and Behavior -> System Settings -> Updates.

I encountered this error when storage of the device is full. Try to open some space.

Try run these commands
adb reconnect
adb reconnect device

Related

Android Studio generating correct app-debug.apk file but showing old version of code

I have an app that is build using React and is wrapped in capacitor. I was having no issues running the app in debug mode on android studio a month ago, or creating release files, but now I am.
I have checked the app-debug.apk (static/js/main.chunk......) file that is created when I select run, and it contains the updated code, I have sent the package to a colleague who ran the .apk on their machine and saw the updated code, but on my emulator and on my android devices, I am seeing an old version of the code.
I have removed all debug-release.apk files on my Mac and followed steps online such as clean build/rebuild, updates off mac, android studio etc but still no luck.
I am at a complete loss now.
Any ideas?
Thanks
Update: After much troubleshooting, we deleted the build folder android>app>build and the rebuilt the app, and ran it, and it fixed the issue.

Android Studio: more info about "Error installing app"

When trying to run the app on the device, I'm facing the following issue:
I the Event Log, there is the same message:
Where can I find more info about the error?
Might work if you Clean the project or rebuild the project and if you launching in emulator uninstall from the emulator or from mobile.
UPDATE:
i think there will be no more information about the error...
It's our common mistakes.
As per my knowledge about this issue there can be a few reasons for that:
First is that your app is already installed with the same package
name but with different certificate, To resolve this check if your
phone has that app already installed then uninstall it and try to
install new one.
The second reason can be that you are trying to install the
application that has minimum SDK version higher than the Android
version of device. To solve this make sure that the minimum SDK
version defined in your project's "build.gradle" is lower than the
Android version of your device.
Turning off the Instant run removed error for Android Studio 2.3.
sometimes project location contained the special character.
Example: E:\Android_Projects\T&PUIET,KUK\app\build\outputs\apk\app-debug.apk
close android studio > rename folder containing the special character(here T&PUIET,KUK ) > restart android studio.
Hope it will help!

Android Studio 2.3.1 | Gradle "AppName" project refresh failed

For 2 days I can't start coding my first android app, because of an issue with Android Studio 2.3.1.
There is many discussions about that out there, but non of them helped me so far.
I'm not able to use Run button for my app or even to edit the main_activity.xml file in the program window. Also the following error occurs when Android Studio starts running.
Screen shot of the error:
I'm workin' on Windows 7, 64bit, 8gb RAM, Java 1.8.0.121. Installed Android Studio 2.3.1 using android-studio-bundle-162.3871768-windows.exe file with no custom settings.
To solve the problem I've tried:
reinstall Android Studio
remove .gradle catalog
use File>>Invalidate Crashes/Restart
nothing helps.
Problem solved!
In my particular case the problem was caused by uncomplete Android Studio installation.
The reason of such an installation was Comodo AntiVirus
I noticed that there was some .bat files blocked during the installation. Comodo doesn't inform about it, but you can check it on blocked features list.
So I removed completely Android Studio, turned off all blocking functions in Comodo and quited it. Then installed AS once again.
Now it works fine. Ad least so far... Luckilly there's no Gradle error, so I hope there won't occur further problems.
Hope that this tip's gonna be helpful to somebody.
Have a good day folks!

Android studio 1.5+ error type 3 - Activity class does not exist

I recently upgraded to Android Studio 1.5 and now every project that I try to Run or debug shows, Activity class does not exist. Solutions that I tried and failed are listed below.
Clean build
Rename Activity class
Restart IDE
Upgrade to Android Studio 2.0 Preview
Install new build tools
I had the same problem.
I realized i've moved all dependencies to my library project. My project compiles with no warnings, but always gives me "segmentation fault" when try to run it.
I duplicated library dependencies to the apk project, and now it starts.
Don't mix dependencies 22.x and 23.x
I hope that this trick works for you too!
Try disable the ADB integration ( Tools- > Android- > Enable Integration) That worked for me. That's the key!
Strange problem , stranger solution. I tried the app on lollipop and now it works fine. I had been installing on Marshmallow (Android 6.0) both on emulator and my device. Though this is not a solution, we can close the question for now.
I also had the same issue when using my own phone (API 18) instead of emulator. Then, after uninstall the previous version of my App, run and install it again, everything worked well... So, I suggest this approach, its worth trying.

Android Studio 0.8.1 can no longer install app. waiting for device

I upgraded to the latest android studio and as ever it breaks what was working fine before.
If I plug in my android device I can see debug in the debug monitor, it gets detected and i can select it as a device to deploy to, then I get
Waiting for device.
Target device: xxxxxxxxxxxx
and nothing else happens.. VERY frustrating. Anyone any ideas on how to resolve?
Here is the resolution:
The problem is the way i installed the newer version of Android Studio. Do not install it over your previous installation directory. Create a new directory and move over your SDK into it. This is how I resolved it.
The only error I was eventually able to get from Android Studio was if i tried to run a test I'd see
NoSuchMethodError: com.android.builder.model.AndroidArtifact.getOutputs()Ljava/util/Collection;: com.android.builder.model.AndroidArtifact.getOutputs()Ljava/util/Collection;
there has been some other posts referring to this issue. Just make sure you do a clean install and don't crap over your older version.
This issue on the AOSP bug tracker tells you what is going on. A quick fix is getting rid of builder-model-0.11.0.jar from plugins/android/lib in your Android Studio folder. A patch has already been submitted and this probably won't happen again with the next update.

Categories

Resources