package name change but not working in gradle - android

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.

Related

I get this error when uploading my app: Upload failed You need to use a different version code for your APK than version code 1

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.

Android Studio - Change applicationId in build.gradle file

How can I change the applicationId field of my build.gradle file?
defaultConfig {
applicationId "com.oldname.appname"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
I've already renamed the package structure to com.newname.appname and all the imports and things like that have updated, but applicationId hasn't. I can't refactor it and just trying to type in a new name brings up a ton of errors where Android Studio will tell me my main FragmantActivity "is not applicable to android.app.Activity" and so on.
Any idea what to do? Thanks in advance.
You can create different flavours for one application in Gradle file. This will increase the code reusability.
An example for an application with Paid and Free flavors:
productFlavors {
paid {
applicationId "com.oldname.appname.paid"
}
free {
applicationId "com.oldname.appname.free"
}
}
So these two flavours will act as two products. You can upload it to play store as different applications.
You can also get four build variant for this two flavours.
com.oldname.appname.free- debug
com.oldname.appname.free- release
com.oldname.appname.paid- debug
com.oldname.appname.paid- release
Apart from the usual java files and manifest that had to be renamed I had to also change the settings under Project Structure:
SO I went to File > Project Structure > Modules/app > Flavours
I then changed the Application ID and all worked great.
Hope this helps for other MAC users like myself. (Did not test on Windows)

You need to use a different version code for your APK because you already have one with version code 1

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.

How to read latest property in property file that is updated earlier in gradle execution

For my Android project I have configured the defaultConfig such that it gets the versionName for the AndroidManifest.xml in the generated apk from a version property in ./gradle.properties. This works great. Here is snippet from build.gradle:
android {
....
defaultConfig {
minSdkVersion 16 //4.1.2
targetSdkVersion 19 //4.4 KitKat
versionName = version //Read from gradle.properties
...
}
The problems is that when I use the townsfolk/gradle-release plugin that plugin updates the property in ./gradle.properties (bumps it up to the next release name) earlier in the execution.
In this scenario the versionName that is read is from the original ./gradle.properties file before it was modified by gradle-release plugin.
How can I force the reading of the property file just in time to pick up the latest property settings? TIA for your help

Android Manifest INSTALL_FAILED_VERSION_DOWNGRADE string resource Gradle

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.

Categories

Resources