How to change android version in android studio

How to Change the API SDK Level in Android Studio?

Generally, API level means the Android Version. This determines which version the developers are targeting their application and what is going to be the minimum level of the android version in their application will run. For setting the Minimum level and Maximum level android studio provides two terminologies.

  • minSdkVersion: This means the minimum Android OS version that will support the app and
  • targetSdkVersion: This means the version for which the developers are actually developing their application.

The app will be compatible with all the versions of android which is falling between minimum level SDK and target SDK. Sometimes during development, there is a need to change the API level of the Android Studio. So to change the API level we have two methods. In this article, we are going to discuss both methods.

Method 1

This method is very simple and very straight forward. One needs to stay very alert while making changes here.

Step 1: Open your project in Android mode then go to Gradle Scripts > build.gradle(Module: app) as shown in the following image.

Step 2: Refer to the below image and here you have to change the minSdkVersion and targetSdkVersion as per the requirement. After changing as per the requirement then you have to click on the Sync Now button and you are done.

Method 2

Step 1: Open Android Studio and go to File > Project Structure as shown in the below image.

Step 2: A pop-up screen will arise like below. Now select the Modules > Default Config and scroll down and you can see two sections as shown in the below image in Default Config. There you change the SDK version as per your requirement and then click on the OK button below. And you are done.

Note: If you are choosing the second Approach then you need not to make changes in Gradle. It will automatically update the gradle.

Источник

How to change the version of android application

Can anyone tell me how I can change my version?

7 Answers 7

Which version do you want to change? If it’s to update your app on the store, you must increment the android:versionCode=»1″ . Which will not be visible for users.

If you want to show users that you incremented your app’s version, you can increment aswell the android:versionName=»1.0″ , just keep in mind that increment the versionCode is mandatory to update your app on the store.

Читайте также:  Что означает смарт платформа андроид

Just try changing .. in your manifest file

Update:: Exporting project ..

That’s it. you are done with your work.

In android Studio add/change versionCode and versionName :

not just in manifest but most importnant inside build.gradle file:: defaultConfig < >of your module: Like that:

Bear in mind that build.gradle is «stronger» then the manifest. Meaning if you have these lines

inside build.gradle then the same lines in manifest will have no influence . If you want to update the version from manifest — then remove this lines from the build.gradle.

android:versionCode — An integer value that represents the version of the application code, relative to other versions.

The value is an integer so that other applications can programmatically evaluate it, for example to check an upgrade or downgrade relationship. You can set the value to any integer you want, however you should make sure that each successive release of your application uses a greater value. The system does not enforce this behavior, but increasing the value with successive releases is normative.

Typically, you would release the first version of your application with versionCode set to 1, then monotonically increase the value with each release, regardless whether the release constitutes a major or minor release. This means that the android:versionCode value does not necessarily have a strong resemblance to the application release version that is visible to the user (see android:versionName , below). Applications and publishing services should not display this version value to users.

android:versionName — A string value that represents the release version of the application code, as it should be shown to users.

The value is a string so that you can describe the application version as a .. string, or as any other type of absolute or relative version identifier.

As with android:versionCode , the system does not use this value for any internal purpose, other than to enable applications to display it to users. Publishing services may also extract the android:versionName value for display to users.

Источник

How To Change API SDK Level In Android Studio

Basically, API level means the Android version. This defines for which version you are targeting your application and what is going to be the minimum level of android version in your application will run. For setting Minimum level and Maximum level android studio provides two terminologies.

minSdkVersion means minimum Android OS version that will support your app and targetSdkVersion means the version for which you are actually developing your application. Your app will be compatible with all the version of android which are falling between minimum level SDK and target SDK.

How to change API SDK level in Android Studio

For changing the API level in android we have two different Approaches, let’s check both one by one:

Approach 1 To Change SDK API Level in Android Studio:

Step 1: Open your Android Studio, and go to Menu. File >Project Structure.

Читайте также:  Андроид с двумя симкартами

Step 2: In project Structure window, select app module in the list given on left side.

Step 3: Select the Flavors tab and under this you will have an option for setting “Min Sdk Version” and for setting “Target Sdk Version”.

You can check the name of version too in the drop down list while selecting the API level that makes the selection more clearer for anyone. Because sometimes remembering numbers is bit messy.

Step 4: Select both the versions and Click OK.

Approach 2 To Change API (Android Version) in Android Studio:

That will be pretty straight forward, but you need to stay very alert while making changes here.

Step 1: if you are project is opened in android option then select open Gradle Scripts > build.gradle(Module: app)

if you are in project View then click on your project folder > app > build.gradle

Step 2: Here you have to change minimum and Maximum sdk level as per your requirement. check the below given code:

Step 3: Click on Sync Now and You are ready to go.

Note: If you are choosing the First Approach then you need not to make changes in Gradle. It will automatically update the gradle.

Источник

How to change the version of app in android studio

I have uploaded an app in Play Store before and now I created second version of that app and ready to upload in Play Store. I changed the version name and code in build.gradle(Module:app) from 1 to 2. It took that Version code but while uploading the app in google play console , But in Google Play Console It is showing that this version already exists. Change the version and upload again.

2 Answers 2

In build.app have youe changed both version code and version name

To answer Eric’s question

1:find the «Project» toolbar (if you are using windows press Alt+1)
2:Inside Project make sure you have opened Android option and not project or any other(it’s located on the top of the window you just opened)
3:Open «Gradle scripts»
4:Click build.gradle (Module:app)

It’s very easy to do. Follow the simple steps

  1. Right-click on the app folder —> Open Module Settings

  1. Select Modules from the left panel, under the Default Config tab, update the Version Code and Version Name .

Version Code always is an integer. You have to update it every time when you release new version of the application.

You can set the Version Name according to your needs. As an example, if you fix minor bugs or update, your Version Name like 2.1, 2.2, etc If you fix major bugs or add more features your Version Name should like 3.0, 4.0, etc.

Источник

How to change Android version and code version number?

How to change Android version and code version number Android Studio? I want to change apk file (app) on Google Play and I need to change Android version and code version number. I tried with this in AndroidManifest.xml file in Android Studio:

Читайте также:  Аналог сири для андроида

But it does not work. When I tried to publish it on Google Play it display that I must to change Android version name and code.

12 Answers 12

Go in the build.gradle and set the version code and name inside the defaultConfig element

The easiest way to set the version in Android Studio:

1. Press SHIFT + CTRL + ALT + S (or File -> Project Structure -> app)

Android Studio = 3.4:

  1. Choose ‘Modules’ in the left panel.
  2. Choose ‘app’ in middle panel.
  3. Choose ‘Default Config’ tab in the right panel.
  4. Scroll down to see and edit ‘Version Code’ and ‘Version Name’ fields.

You can define your versionName and versionCode in your module’s build.gradle file like this :

Press Ctrl + Alt + Shift + S in android studio or go to File > Project Structure.

Select app on left side and select Flavors tab on right side on default config change version code, name and etc.

You can manage your application versioning wisely by using the Advanced Build Version Plugin for Gradle.

You just need to include the plugin in yout build.gradle :

And then you can use the versioning functions (and, obviously, customize them):

For more information, take a look at the official documentation.

Open your build.gradle file and make sure you have versionCode and versionName inside defaultConfig element. If not, add them. Refer to this link for more details.

Go in the build.gradle and set the version code and name inside the defaultConfig element

After updating the manifest file, instead of building your project, go to command line and reach the path . bld\Debug\platforms\android. Run the command «ant release». Your new release.apk file will have a new version code.

I didn’t get the other answers to work in Android Studio 1.4. But this worked: click on your app name to the left below the main ribbon. It will show a list of files. Open AndroidManifest.xml and change the version code and version number there.

The official documentation on this is here.

The short answer is do it in Gradle not the manifest, Gradle overwrites the manifest.

The File | Project Structure | Modules | Default Config answer given above just updates Gradle via a UI rather than by directly editing XML.

The longer answer is:

If your app defines the app version directly in the element, the version values in the Gradle build file will override the settings in the manifest. Additionally, defining these settings in the Gradle build files allows you to specify different values for different versions of your app. For greater flexibility and to avoid potential overwriting when the manifest is merged, you should remove these attributes from the element and define your version settings in the Gradle build files instead.

Источник

Оцените статью