INSTALL_FAILED_INVALID_APK for debug only (release works) - android

I was running Android Studio 3.5. My code was compiling and installing onto the emulator just fine.
I updated Android Studio to 3.6.1.
The only parts of my code that change are:
gradle updated from 5.4.1 to 5.6.4
Android gradle build tools updated from 3.5.3 to 3.6.1
Now I get the following error when trying to run the debug flavor (release works fine) of my app
Installation did not succeed.
The application could not be installed:
INSTALL_FAILED_INVALID_APK The APKs are invalid.
I have tried to delete the emulator and make a new one. I have tried clean, rebuild, invalidate cache. Nothing seems to be working.

Found the solution to my own problem. Note to others, make sure your libraries and classpaths are always up to date. I had a classpath for firebase plugins that was not up to date. When applying the new gradle, this problem occurred. After updating the classpath everything installed smoothly again

This problem is usually caused due to a difference in the mainfest package name and the Gradle applicationId.
First, check that they both are same.
Then, check that there are no spaces in the package name and it has proper (.) separators.
Also, check that it has no other separators (- or,) other than (.).
This should work for you.
Do post your manifest and Gradle configuration file.

Related

Upgraded gradle version Android Studio Ubuntu 20.04 LTS

I just upgraded my android studio version and gradle version to the new one as AS suggest me. But now every time I try to build my project gradle has this error:
Could not create parent directory for lock file /opt/android-studio/plugins/gradle/wrapper/dists/gradle-7.5-bin/f1w0cc9nuo0eivz97x2xlu9sv/gradle-7.5-bin.zip.lck
Of course it worked perfectly fine before upgrade and I didn't change anything manually in path or version used.
I know it's a permission error, but I tried to build it as sudo, it downloaded and installed correctly but once I went back to a normal user process, it can't recognize that gradle has already been installed on my system. I have this error
The specified Gradle distribution 'https://services.gradle.org/distributions/gradle-7.5-bin.zip' does not exist.
knowing I didn't change anything in my path or used version while swapping between sudo and normal user.
Does anyone know how to force AS to detect and use already installed gradle version?
One option will be to open Android Studio's settings:
Build, Excecution, Deployment > Build Tools > Gradle
and from there you can specify whether to use Gradle from gradle-wrapper.properties file or from a specified location. The latter should fit your needs.
Tested with AS Chipmunk and Dolphin.

No builders are available to build a model of type 'org.jetbrains.plugins.gradle.model.internal.DummyModel'

After upgrading Android Studio to 4.0 version and in "gradle-wrapper.properties" :
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip
I am getting the following error in Android Studio while syncing:
No builders are available to build a model of type 'org.jetbrains.plugins.gradle.model.internal.DummyModel'.
and unable to create or run the app build.
This can be one solution. I tried Copy and Cut everything in the setting.gradle file located in the project directory then SYNC project after Gradle is complete. Later paste the content back to the file and SYNC again. This not worked for me but for others, it worked.
Another solution is to downgrade the android studio to v 3.6.3 download by clicking here. You can follow these steps to downgrade the android studio. This solution worked for me and now I can build and run the application successfully.
I solved it by navigating to the Project settings in the settings.gradle file and COPY and CUT everything then SYNC the project after gradle is complete PASTE back the content you had copied and SYNC again.
This worked for me
Still not worked
Please use different gradle version.
ie case gradle-wrapper.properties. Instead of your version
distributionUrl=https://services.gradle.org/distributions/gradle-*.*.*-all.zip
update with
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Thanks
I tried all the solutions above but I didn't succeed so I uninstall android studio and then installed it again and saw all the problems solved and I have no problem . so I recommend you reinstall the program as a last step .
REINSTALL

Data binding with errror dataBindingArtifactOutputDir

I have a weird problem when building my app.
Cannot write to file
'myapp/app/build/intermediates/data-binding/dev/debug/bundle-bin'
specified for property 'dataBindingArtifactOutputDir' as it is a
directory.
It 's weird because when I clean project, I can build app. But when building app the second time, the above error happens. If I want to build app, must clean app.
I also set
dataBinding {
enabled true
}
Thanks for any support!
I really found the problems. I took me 1 day. I updated the gradle plugin and Android Studio to the newest version. And this is the reason why.
The newest gradle build tool is 3.4.1, it use the gradle version 5.1.1. When I downgrade the gradle build tool to 3.1.4 as my old project, and clean build app again error still happens. I think this way did not work but this is problem of Android Studio, it did not change the gradle version in gradle/wrapper/gradle-wrapper.properties. I manually update to old gradle version
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
It works now luckily. Everytime Android Studio updates, the weird problems happens again. Expect everything will work well in the future. :|

Synchronize Gradle and Android Studio Versions

Android studio was taking up a massive amount of disk space on my computer (over 50 GB) and my old 90 GB ssd was completely full. I tried to reduce the amount of space that was being used by completely removing everything from android studio except my project and then reinstalling it.
There were some problems that I worked through, such as updating the sdk version, but I am stuck on this error message:
Error running app: This version of Android Studio is incompatible with the Gradle Plugin used. Try disabling Instant Run (or updating either the IDE or the Gradle plugin to the latest version)
I tried disabling instant run, but it did not fix the problem, and I like instant run anyway.
I also tried installing a new version of gradle and then pointing to it in settings/buildtools/gradle, and I've also tried checking the box to use the default wrapper instead.
I tried modifying my class path in build.gradle when I changed to gradle 3.0 in the settings above:
classpath 'com.android.tools.build:gradle:2.2.0-beta1'
My android studio is version 2.1.3/143.3101438
How do I get the right version of gradle installed and update my project to use it?
I got it working now. I had to specify the version of gradle in three places. First in settings/buildtools/gradle set it to use the default wrapper. Second specify the gradle version in build.gradle:
classpath 'com.android.tools.build:gradle:2.1.3'
Third, in gradle.wrapper.properties specify the gradle version:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
(I originally set it to ...gradle-2.13-all.zip, but it changed it to 2.14.1 after i put in 2.13, but it did not update the version in the build.gradle file)
I'm still very much confused what gradle is doing, why I need to specify the version 3 times, but at least it works.

Android Studio 2.2 preview1 errors

So i'm trying to use Android Studio 2.2 preview-1 in Ubuntu 14.04 LTS.
I'm using gradle-2.10 and gradle-plugin 2.2.0-alpha1 along with openJDK-8.
compileSdkVersion 23
buildToolsVersion "23.0.3"
First the studio.sh didn't run and i found the solution to change #!/bin/sh to #!/bin/bash. Voila --it starts properly.
But in build.gradle files, warning is shown--
'dependencies' cannot be applied to '(groovy.lang.Closure)'
and its not finding imported class from library project(includes a jar only).
Please someone help me out.
The only fix that I found for this is, every time I open a project, I go to Settings>Build, Execution, Deployment>Gradle, change to "use local gradle distribution", click apply then click "use default gradle wrapper" and ok.
This should fix, but its quite annoying to do this everytime.
It Looks like a problem of version 2.10 of the wrapper version on gradle.
After reading around people's workaround like
"invalidate cache and restart"
delete .gradle file in the project and re-open it
etc etc
I just try for fun to install a standalone version of gradle since I'd always used only the wrapper version that cames with android studio.
And with it there is any error and any warning.
For anyone who wanna try (I'm a mac's user):
install gradle (by homebrew is fine and pretty easy) brew install gradle
tell to AS to use that one instead the wrapper version preference -> build, Execution, Deveployment -> Gradle -> use local gradle distribution
if you install it by homebrew like me the correct path will be: /usr/local/Cellar/gradle/x.yy/libexec
where x.yy it suppose to be 2.11 (that is the last version provide by brew even if the lastest version released is 2.13)
I've realised just now that the steps above doens't fix the definitly. Each time you re-open the project the problem came again and again.
It's annoying but changing betwen use of "wrapper"/"regular gradle" take the warning away.
But this means also that isn't a problem o the gradle as I'd assumed at the beginning.
...let's wait a permanent fix ^^
This issue is fixed in Android Studio 2.2 preview 2 (download from this page).
Disabled a couple of Groovy inspections that reported incorrect errors in build.gradle files
From the changelog.

Categories

Resources