Unwanted versioncode increment in android Manifest - android

I am trying to deploy a version 1.1 update to my android apk of my worklight app. However when I try to update the versionName on my Manifest and build the project, it automatically gets updated back to 1.0 (updated to 1.1) and versionCode is also auto incremented. I do not want this to happen and I want an updated version 1.1 to be built. Any help here please ?
example entry below... the versionCode got updated to 13 from 12.
android:versionCode="13" android:versionName="1.0"
I use eclipse/worklight and not Android Studio. This auto update is still kind of confusing me.

If you are using Android Studio settings in your app build.gradle will override your app manifest.
Make your changes in build.gradle file
defaultConfig {
applicationId "com.abc.yourapp"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.1"
}

Try this code to change version
here is link
if it is not working for you then clean project and then rebuild it

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.

Set targetSdkVersion = 22 still need in app permission for Marshmallow device? [duplicate]

I want to change the targetSdkVersion from 19 to 18 in Android Studio (not Eclipse), but failed.
Android Studio complains the following after I changed the targetSdkVersion, and resync the project with Gradle files:
Execution failed for task ':(project name):processDebugManifest'.
> Manifest merging failed. See console for more info.
From the console I found that it is the library I added to the gradle dependencies using the old targetSdkVersion value.
[(Code Directory)\main\AndroidManifest.xml, (Code Directory)\build\exploded-bundles\(Library Directory).aar\AndroidManifest.xml:2] Main manifest has <uses-sdk android:targetSdkVersion='18'> but library uses targetSdkVersion='19'
I learn that in Android Studio, the targetSdkVersion and minSdkVersion flags are defined in the build.gradle file. The project is created with Android Studio's "New project" wizard, and there is NO tag in my code's AndroidManifest.xml. So the problem should not be the two values out of sync. According to the above message, the targetSdkVersion value in the main manifest is what I want.
So the problem should be in the manifest file of the library. I open the library's AndroidManifest.xml file and found the following line:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19"/>
Obviously it isn't correct. The problem is that the file is not for manual modification. I tried changing the targetSdkVersion value, and even tried removing the declaration, but it comes back every time I build the project.
I tried cleaning the project, still no luck.
So my question is: Is there a "right" way to alter the targetSdkVersion in Android Studio which I am not aware of?
Here's how to change the targetSdkVersion and minSdkVersion in Android Studio.
Step 1
Open build.gradle - Path\Your_Application\app\build.gradle.
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
Change the targetSdkVersion and minSdkVersion values to what you desire.
Step 2
In the Android Studio menu, find "Build" (Alt + b in Windows) and choose "Clean project".
Alternatively, click on File > Project Structure > Application > Flavours > Min Sdk Version and press ok on change. You can also change the Target Sdk Version as well. I think this is a neater approach to editing the gradle build file directly.
in build.gradle
Change these values according to current project Updation
in sdk manager
compileSdkVersion 25
buildToolsVersion "25.0.2"
minSdkVersion 15
targetSdkVersion 25
in dependencies replace below code
compile 'com.android.support:appcompat-v7:25.1.0'
and synchronise project

Apps are not supported in lesser than v5.0(lollipop)

In android studio, i have create new project that run on 2.2(that shows 100% compatibility). The project is about calculation. I have installed on my phone(lollipop), and the app is working properly. But, I tried to install in my friends kitkat phone, the app is installed but, When i open the app, that shows Unfortunately the app has stopped. So, I need a help. What I have to do?
Thank You.
May be you set Minimum SDK at Lollipop check it out in build.gradle file.
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.communitynow.communitynow"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
and add
compile 'com.android.support:multidex:1.0.0'
in gradle file
Here in defaultConig{} minSdkVersion should be 15 or according to your minimum android run requirement.
You need to create a kit kat emulator to run the app on then check the log cat to see what the error is.

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.

Android Studio: What is the right way to change targetSdkVersion?

I want to change the targetSdkVersion from 19 to 18 in Android Studio (not Eclipse), but failed.
Android Studio complains the following after I changed the targetSdkVersion, and resync the project with Gradle files:
Execution failed for task ':(project name):processDebugManifest'.
> Manifest merging failed. See console for more info.
From the console I found that it is the library I added to the gradle dependencies using the old targetSdkVersion value.
[(Code Directory)\main\AndroidManifest.xml, (Code Directory)\build\exploded-bundles\(Library Directory).aar\AndroidManifest.xml:2] Main manifest has <uses-sdk android:targetSdkVersion='18'> but library uses targetSdkVersion='19'
I learn that in Android Studio, the targetSdkVersion and minSdkVersion flags are defined in the build.gradle file. The project is created with Android Studio's "New project" wizard, and there is NO tag in my code's AndroidManifest.xml. So the problem should not be the two values out of sync. According to the above message, the targetSdkVersion value in the main manifest is what I want.
So the problem should be in the manifest file of the library. I open the library's AndroidManifest.xml file and found the following line:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19"/>
Obviously it isn't correct. The problem is that the file is not for manual modification. I tried changing the targetSdkVersion value, and even tried removing the declaration, but it comes back every time I build the project.
I tried cleaning the project, still no luck.
So my question is: Is there a "right" way to alter the targetSdkVersion in Android Studio which I am not aware of?
Here's how to change the targetSdkVersion and minSdkVersion in Android Studio.
Step 1
Open build.gradle - Path\Your_Application\app\build.gradle.
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
Change the targetSdkVersion and minSdkVersion values to what you desire.
Step 2
In the Android Studio menu, find "Build" (Alt + b in Windows) and choose "Clean project".
Alternatively, click on File > Project Structure > Application > Flavours > Min Sdk Version and press ok on change. You can also change the Target Sdk Version as well. I think this is a neater approach to editing the gradle build file directly.
in build.gradle
Change these values according to current project Updation
in sdk manager
compileSdkVersion 25
buildToolsVersion "25.0.2"
minSdkVersion 15
targetSdkVersion 25
in dependencies replace below code
compile 'com.android.support:appcompat-v7:25.1.0'
and synchronise project

Categories

Resources