I have replaced the app version and name variables in my manifest file with resource references. The issue that is occurring now though is that regardless of what number I set in my resources file the app still gives this error.
Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
This is the change ive made to the manifest
android:versionCode="#integer/version_code"
android:versionName="#string/version_name" >
Does anyone know why this is occurring and how I might be able to correct it?
If you're using gradle for building your APKs. Your build.gradle file is replacing the versionCode and versionName values in the androidManifest file. So doesn't matter where you've defined your code and version name. When you change those values directly in your manifest, they'll always be overridden by gradle.
consumer {
versionCode 123
versionName "1.0.0"
applicationId "com.example.android"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
Removing your current installation of your apk and reinstalling will also solve this problem.
Related
I have an app on google play store. Currently there's only one upload.
And I want to upload a new version, but when ever I do that this error shows:
Upload failed You need to use a different version code for your APK because you already have one with version code 1
No matter weather it is versioncode 1, 2 or 3. The first release way versioncode 1, and this is versioncode 2.
I don't know what the problem is, maybe I have to sync the build.gradle, I've heard some ppl talk about that, but I am not 100% sure how to?
Also If I make a new 'App' and upload it there this error doesn't show op, that's probably because on that 'app' there's no other app-release with that name, or any with higher.
Also, there's like 300 different build.gradle files, the one I am talking about is the one under the directory
ApplicatioName\myApplication\build.gradle
Here is the build.gradle:
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 16
targetSdkVersion 30
versionCode 2
versionName "2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
What do I do?
In Flutter, at least in my experience, you don't need to modify version codes anywhere but in pubspec.yaml. Say your version tag there is version: 1.0.0+1, your android version code will be 1 and your user visible version name is 1.0.0. You can change this to version: 1.1.0+2, for example, and that should fix your problem.
Edit: And, obviously, rebuild.
package com.abhimathgame.shubham.mindsharp;
In build.gradle in manually change the package name
defaultConfig {
applicationId "com.abhimathgame.shubham.mindsharp"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
And after that i sync the gradle but it return error and whrn is use
applicationId "com.example.shubham.mindsharp"
it ok but not publish on Playstore Error Image for more help
Try first of all to update google service to the most recent version.
Also do you use flavors?
Also could be that you re using New Relic as indicated in this post? It is referring to this tutorial where is explained exactly the nature of the issue:
the google_services.json must reside in the root of your :app module
and not within a buildType/productVariant folder, so Gradle cannot
handle this automatically for you via folder placement.
Make sure your package name is same at all the places. Also if you have added google-services.json file from firebase in your project make sure the packagename added there is correct.
Hope this is helpful.
i know this has been ask here
The correct answer is to change the version does not solve my problem
id did added this two lines in my manifest
android:versionCode="2"
android:versionName="2.01"
but then when i clean and build using android studio the generate the apk again then upload the same error happend ..
Note: I did check that it is the correct file that i try to upload in the developer console
In the build.gradle file check if you have versionCode like
defaultConfig {
minSdkVersion 10
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
because if you have mentioned versionCode in build.gradle file then it will overwrite the values in manifest file. Please make sure if you have mentioned version code here then you have updated here also.
Change it in the build.gradle file of your app module in Android Studio.
Remove those from your manifest. Go to File>Project Structure> And either flavors or build types (don't remember and don't have my pc on me). Set the version name and version code from there.
I need to use the versionName tag from the AndroidManifest.xml file in jenkins builds.
For now, i change the jenkins release version manually, when the android version changes, for example: 1.2.1:${BUILD_NUMBER}. I want to use the versionName tag from the manifest file instead of the hardcoded 1.2.1.
Is there a way i can do this?
Thanks in advance!
I created a new project in android studio and one of the first things I did was to move the versionCode an versionName attributes from build.gradle to the manifest file for convenience. Then i get this weird warning saying:
This versionCode value (1) is not used; it is always written by the
value specified in the Gradle build script (-1)
It started appearing in my older projects too, so it's clearly not a project specific problem. Something may happened when I updated to 0.8.14 and updated the build tools, but I have no ide what. Any ideas on how to fix this?
According to official doc, gradle overrides some values in AndroidManifest.
The default value in DSL object for the versionCode is -1.
Then when gradle builds your apk, overrides the value in Manifest and assign the versionCode=-1
You already explained the source of this problem: you can't move the versioning information to the manifest in gradle-based projects. You should use build.grade for the version code and name.
Well, probably the Gradle build system expects you to keep the versionCode and versionName there and if it is missing, it does not know what to do. It is recommended to keep those values in the build.gradle file instead of in AndroidManifest anyway