My android application using Kotlin is throwing this exception when I try to Run \'app\' in the emulator o in my cellphone. When I build my project it runs well, with no err
AS 4.0.1 (installed via snap)
Ubuntu 18.04 lts
configuring builds via build variant.
Combinations of invalidate cache / build / clean etc didnt help on their own, the only thing that helped was to switch build the active build variant back to armDebug
and clean / rebuild after that.
Once I switched back to the desired variant I could build correctly.
The solution :-
1- Build -> Clean Project
didn't help
2-Build -> Make Project
didn't help
3- restart android studio didn't help
4- Manually remove Build folder from app
and project
didn't help
the only solution for me was to remove all old builds from destination folder
I was getting this error also, when trying to "Generate Signed APK" for my release version. I tried all of the above methods, unfortunately none worked for me.
What worked, was generating first the debug signed version of the app, and then generating again the release one.
I do not know what exactly changed or what the original problem was, but it worked. I hope it will help you too, because this error is quite annoying...
All the solutions didn't work with me
In my case from AndroidStudio 3.4+ update to 3.5.
And finally I solve it by modify 'Destination Folder' to "app/build/outputs/apk"
detail pic
I have android studio 3.5.1 . For me below steps are worked
Click Build
-> Clean Project
Then Build
-> Make Project
Tested on gradle 3.5.0-alpha3, -alpha5 and 3.4.0 (project gradle)
classpath 'com.android.tools.build:gradle:3.5.0-alpha03'