I want to change the minimum SDK version in Android Studio from API 12 to API 14. I have tried changing it in the manifest file, i.e.,
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="18" />
and rebuilding the project, but I still get the Android Studio IDE throwing up some errors. I presume I have to set the min SDK in ‘project properties’ or something similar so the IDE recognizes the change, but I can’t find where this is done in Android Studio.
Laurel
5,90314 gold badges30 silver badges56 bronze badges
asked Oct 19, 2013 at 10:31
8
When you want to update your minSdkVersion in an existing Android project…
- Update
build.gradle (Module: YourProject)
under Gradle Script and
make sure that it is NOTbuild.gradle (Project: YourProject.app)
.
An example of build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.2"
defaultConfig {
applicationId "com.stackoverflow.answer"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
androidTestCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
- Sync gradle button (refresh all gradle projects also works).
or
- Rebuild project
After updating the build.gradle‘s minSdkVersion
, you have to click on the button to sync gradle file («Sync Project with Gradle files»). That will clear the marker.
Updating manifest.xml, for e.g. deleting any references to SDK levels in the manifest file, is NOT necessary anymore in Android Studio.
Terry
9858 silver badges29 bronze badges
answered Nov 23, 2013 at 21:08
SottiSotti
13.9k2 gold badges50 silver badges43 bronze badges
12
Update 2022
For Android Studio users:
-
Right click the App directory and
Choose the «Open Module Settings» (F4) option
-
Change the «Min SDK Version» in the Default Config tab
NOTE:
You might also want to change;
the «Target SDK Version» in the Default Config tab and
the «Compile SDK Version» in the Properties tab
-
Click Apply, then OK, and Gradle should automatically be synced
For users of older Android Studio versions:
- Right click the App directory and
Choose the «Module Setting» (F4) option - Change the ADK Platform to what you need
- Click OK and Gradle should automatically be synced
Ola Ström
3,5644 gold badges20 silver badges40 bronze badges
answered Feb 10, 2014 at 0:29
user3291001user3291001
1,9191 gold badge11 silver badges3 bronze badges
4
As now Android Studio is stable, there is an easy way to do it.
- Right click on your project file
- Select «Open Module Settings»
- Go to the «Flavors» tab.
- Select the Min SDK Version from the drop down list
PS: Though this question was already answered but Android Studio has changed a little bit by its stable release. So an easy straight forward way will help any new answer seeker landing here.
Isuru
30.1k59 gold badges187 silver badges295 bronze badges
answered Dec 23, 2014 at 19:20
priyankvexpriyankvex
5,6805 gold badges27 silver badges43 bronze badges
5
In android studio you can easily press:
- Ctrl + Shift + Alt + S.
- If you have a newer version of
android studio
, then press on app first.
Then, continue with step three as follows. - A window will open with a bunch of options
- Go to Flavors and that’s actually all you need
You can also change the versionCode
of your app there.
Daniel
451 silver badge9 bronze badges
answered May 13, 2015 at 19:48
Salah KleinSalah Klein
3703 silver badges12 bronze badges
In build.gradle
change minSdkVersion 13
to minSdkVersion 8
Thats all you need to do. I solved my problem by only doing this.
defaultConfig {
applicationId "com.example.sabrim.sbrtest"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
answered Jul 5, 2014 at 13:57
Sabri MevişSabri Meviş
2,1011 gold badge30 silver badges34 bronze badges
According to this answer, you just don’t include minsdkversion in the manifest.xml, and the build system will use the values from the build.gradle file and put the information into the final apk.
Because the build system needs this information anyway, this makes sense. You should not need to define this values two times.
You just have to sync the project after changing the build.gradle
file, but Android Studio 0.5.2 display a yellow status bar on top of the build.gradle editor window to help you
Also note there at least two build.gradle
files: one master and one for the app/module. The one to change is in the app/module, it already includes a property minSdkVersion
in a newly generated project.
answered Apr 15, 2014 at 9:10
MeierMeier
3,8381 gold badge17 silver badges46 bronze badges
For the latest Android Studio v2.3.3 (October 11th, 2017) :
1. Click View
on menu bar
2. Click Open Module Settings
3. Open Flavors
tab
4. Choose Min Sdk
version you need
6. Click OK
AnneTheAgile
9,7566 gold badges50 silver badges48 bronze badges
answered Oct 10, 2017 at 21:32
RidoRido
7174 gold badges10 silver badges22 bronze badges
If you’re having troubles specifying the SDK target to Google APIs instead of the base Platform SDK just change the compileSdkVersion 19
to compileSdkVersion "Google Inc.:Google APIs:19"
answered May 7, 2014 at 18:16
Juan ReyesJuan Reyes
4045 silver badges9 bronze badges
As well as updating the manifest, update the module’s build.gradle
file too (it’s listed in the project pane just below the manifest — if there’s no minSdkVersion
key in it, you’re looking at the wrong one, as there’s a couple). A rebuild and things should be fine…
answered Nov 10, 2013 at 11:44
Chris RollistonChris Rolliston
4,7781 gold badge15 silver badges20 bronze badges
0
In Android studio open build.gradle and edit the following section:
defaultConfig {
applicationId "com.demo.myanswer"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
here you can change minSdkVersion from 12 to 14
nstCactus
5,0032 gold badges30 silver badges41 bronze badges
answered May 20, 2016 at 7:35
File>Project Structure>Modules
you can change it from there
answered Feb 7, 2020 at 18:31
Wisam AtilWisam Atil
811 silver badge9 bronze badges
When you want to change minimum SDK you should take care of minSdkVersion
[About] in module build.garadle
android {
defaultConfig {
minSdkVersion 21
}
}
answered May 30, 2021 at 14:02
yoAlex5yoAlex5
26.5k8 gold badges180 silver badges191 bronze badges
Changing the minSdkVersion in the manifest is not necessary. If you change it in the gradle build file, as seen below, you accomplish what you need to do.
defaultConfig {
applicationId "com.demo.myanswer"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
answered Jul 1, 2016 at 15:10
Chris DeckChris Deck
1462 silver badges9 bronze badges
To change the minimum SDK version in Android Studio just…
1). Right click on «app» in the «Project» panel
2). Choose the new «Min SDK Version» on the «Default Config» tab
3). Click on «OK» and the project will now resync with the new Gradle settings.
answered Sep 7, 2022 at 18:41
SnostorpSnostorp
4687 silver badges12 bronze badges
For me what worked was: (right click)project->android tools->clear lint markers. Although for some reason the Manifest reverted to the old (lower) minimum API level, but after I changed it back to the new (higher) API level there was no red error underline and the project now uses the new minimum API level.
Edit: Sorry, I see you were using Android Studio, not Eclipse. But I guess there is a similar ‘clear lint markers’ in Studio somewhere and it might solve the problem.
answered Oct 27, 2013 at 9:27
Gradle Scripts ->
build.gradle (Module: app) ->
minSdkVersion (Your min sdk version)
answered Jul 12, 2016 at 11:27
Уровень API — это целочисленное значение, однозначно идентифицирующее версию API фреймворка, предлагаемую версией платформы Android. Платформа Android предоставляет интерфейс API, который приложения могут использовать для взаимодействия с базовой системой Android. API фреймворка состоит из:
- Основной набор пакетов и классов
- Набор элементов и атрибутов XML для объявления файла манифеста
- Набор XML-элементов и атрибутов для объявления и доступа к ресурсам
- Набор Интентов
- Набор разрешений, которые могут запрашивать приложения, а также принудительное применение разрешений, включенных в систему
Использование уровня API в Android
Идентификатор уровня API играет ключевую роль в обеспечении наилучшего опыта для пользователей и разработчиков приложений:
- Это позволяет платформе Android описать максимальную версию API, которую она поддерживает
- Это позволяет приложениям описывать версию API фреймворка, которая им требуется
- Это позволяет системе согласовывать установку приложений на устройство пользователя, так что несовместимые по версии приложения не устанавливаются.
Каждая версия платформы Android хранит свой идентификатор уровня API внутри самой системы Android.
Что такое SdkVersion?
Приложения могут использовать элемент манифеста, предоставляемый API фреймворка — для описания минимального и максимального уровней API, на которых они могут работать, а также предпочтительного уровня API, который они предназначены для поддержки. Элемент предлагает три ключевых атрибута:
- минсдкверсион — Указывает минимальный уровень API, на котором приложение может работать. Значение по умолчанию — «1».
- targetSdkVersion — Определяет уровень API, на котором приложение предназначено для работы. В некоторых случаях это позволяет приложению использовать элементы манифеста или поведения, определенные на целевом уровне API, а не ограничиваться использованием только тех, которые определены для минимального уровня API.
- макссдкверсион — Указывает максимальный уровень API, на котором приложение может работать
Когда пользователь пытается установить приложение или повторно проверяет приложение после обновления системы, система Android сначала проверяет атрибуты в манифесте приложения и сравнивает значения со своим собственным внутренним уровнем API. Система позволяет начать установку только при соблюдении следующих условий:
- Если андроид: minSdkVersion объявлен атрибут, его значение должно быть меньше или равно целому числу системного уровня API. Если не объявлено, система предполагает, что приложению требуется уровень API 1.
- Если андроид: maxSdkVersion объявлен атрибут, его значение должно быть больше или равно целому числу системного уровня API. Если не объявлено, система предполагает, что приложение не имеет максимального уровня API.
Как изменить приложение для Android SdkVersion
Вы можете использовать Android Studio для изменения уровня API приложения Android (версия SDK) с помощью этих двух методов.
- Выберите «Проект» в представлении проекта.
- В папке приложения выберите «build.gradle‘ файл
- Теперь вы можете редактировать минсдкверсион и targetSdkVersion отображается на правой панели
- После этого нажмите «Синхронизировать» в правом верхнем углу окна «наращивание Gradle‘ файл
б. В диалоге структуры проекта
- В верхнем меню выберите Файл> Проект Структура
- В диалоговом окне «Структура проекта» выберите «приложение» в списке модулей.
- Выберите вкладку «Ароматизаторы» на правой панели.
- Выберите желаемый минсдкверсион и targetSdkVersion
- Нажмите «ОК», чтобы сохранить выбор.
- В верхнем меню нажмите Сборка> Перестроить проект, чтобы восстановить проект Android
- Компания build.gradle файл будет изменен автоматически
Sometimes your favorite Android app is one that is not available on the Play Store and hasn’t been updated in ages. You get your latest and greatest new phone/tablet, and now you are excited to install that one app not available on the Play Store. Suddenly you find out you cannot install it due to the Android SDK API target level being too low, or maybe the signature has expired and the app cannot be installed anymore.
Well, in this tutorial I will show you how to change the SDK API Level to a 3rd Party Android APK. It is easier than you might think, and you don’t even need Android Studio installed on your computer, or have awesome Java programming skills.
[topads][/topads]
Getting your Computer Ready
Make sure you have Java 1.8 or greater installed (needed for some of the tools we are going to be using). To find out what version of Java you are running, type the following command in your Terminal (macOS) or Command Prompt (Windows)
java -version
If you do not have Java installed, follow the official instructions.
Reverse Engineering the APK File
This is where you actually change the SDK API Level, but first you need to download Apktool. Head over to the official site and download the tool.
You will notice this is not your typical .dmg or .exe file, but rather a .jar file (basically a ZIP file containing Java class files and associated resources). In order to run it you need Java installed in your machine.
There are several actions Apktool can perform, but we are only concerned with two: decode and build.
Now we need the APK file we are wanting to update. For the sake of this example I will be using Anime Mobile, so I will refer to this file for the rest of the tutorial. When downloaded, this is the file name: com.anime.mobile.31.apk.
First, we need to decode the APK file. Open your Terminal or Command Prompt and navigate to the directory where you downloaded Apktool and type the following
java -jar apktool_2.3.4.jar d [Path to apk file]/com.anime.mobile.31.apk
You will see some output logs and the tool will create a directory in the same location of the tool and the same name as the APK file. In our case it will create com.anime.mobile.31 directory.
In Finder or Windows Explorer, navigate to com.anime.mobile.31 directory and open apktool.yml file. Towards the end you will find the line where you need to change the target SDK API Level, as the following
targetSdkVersion: "[API Level Version]"
Change the version number to the one you are wanting to use, save the file and close it.
Now it’s time to re-create the APK file. For that we will use the build command. Type the following in your Terminal or Command Prompt
java -jar apktool_2.3.4.jar b com.anime.mobile.31
Again you will see some logs, and after it finishes building the APK, open com.anime.mobile.31 directory and inside it you will see dist directory with the newly built APK file. At this point the file is not yet ready to be installed in your Android device. You will have to resign the APK file.
Getting the Necessary Command Line Tools
In order to sign the APK, we will need two command line tools: zipalign and apksigner. If you do not have Android Studio installed, you just have to download the SDK tools.
Once you have downloaded the tools and unzipped them, open Terminal or Command Prompt and navigate to tools -> bin. What we want is the sdkmanager command line utility.
Still under the bin directory, type the following
./sdkmanager --install "build-tools;26.0.3"
This will install the tools we need to sign our APK file under the build-tools directory (one level up from our current directory).
Note: Running ./sdkmanager –list will give you a listing of all the packages available for download, including different versions of the build-tools, platform-tools and other packages. The following is a sample output of the command
$ bin ./sdkmanager --list Installed packages:=====================] 100% Computing updates... Path | Version | Description | Location ------- | ------- | ------- | ------- platform-tools | 27.0.1 | Android SDK Platform-Tools 27.0.1 | platform-tools/ platforms;android-26 | 2 | Android SDK Platform 26 | platforms/android-26/ tools | 26.1.1 | Android SDK Tools 26.1.1 | tools/ Available Packages: Path | Version | Description ------- | ------- | ------- add-ons;addon-google_apis-google-15 | 3 | Google APIs add-ons;addon-google_apis-google-16 | 4 | Google APIs add-ons;addon-google_apis-google-17 | 4 | Google APIs add-ons;addon-google_apis-google-18 | 4 | Google APIs add-ons;addon-google_apis-google-19 | 20 | Google APIs add-ons;addon-google_apis-google-21 | 1 | Google APIs add-ons;addon-google_apis-google-22 | 1 | Google APIs add-ons;addon-google_apis-google-23 | 1 | Google APIs add-ons;addon-google_apis-google-24 | 1 | Google APIs add-ons;addon-google_gdk-google-19 | 11 | Glass Development Kit Preview build-tools;19.1.0 | 19.1.0 | Android SDK Build-Tools 19.1 build-tools;20.0.0 | 20.0.0 | Android SDK Build-Tools 20 build-tools;21.1.2 | 21.1.2 | Android SDK Build-Tools 21.1.2 build-tools;22.0.1 | 22.0.1 | Android SDK Build-Tools 22.0.1 build-tools;23.0.1 | 23.0.1 | Android SDK Build-Tools 23.0.1 build-tools;23.0.2 | 23.0.2 | Android SDK Build-Tools 23.0.2 build-tools;23.0.3 | 23.0.3 | Android SDK Build-Tools 23.0.3 build-tools;24.0.0 | 24.0.0 | Android SDK Build-Tools 24 build-tools;24.0.1 | 24.0.1 | Android SDK Build-Tools 24.0.1 build-tools;24.0.2 | 24.0.2 | Android SDK Build-Tools 24.0.2 ...
Once you have downloaded the build-tools, in your Terminal or Command Prompt navigate to the build-tools/26.0.3 directory.
cd ../build-tools/26.0.3
Signing The APK File
Before using the utilities provided by the build tools, you will need to generate a private key file with a Java utility. Type the following in your Terminal or Command Prompt
keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias
Follow the steps indicated by the utility, and remember the password because you will use it later when signing the APK file. After you finish with the steps, a file named my-release-key.jks will be generated.
Still in your Terminal or Command Prompt under the build-tools/26.0.3 directory, type the following
./zipalign -v -p 4 [your path]/com.anime.mobile.31/dist/com.anime.mobile.31.apk [your path]/com.anime.mobile.31/dist/com.anime.mobile.31-aligned.apk
Basically the first APK file in the command is the one that was generated by Apktool and the second one is the one zipalign will create (com.anime.mobile.31-aligned.apk).
From the official documentation: zipalign ensures that all uncompressed data starts with a particular byte alignment relative to the start of the file, which may reduce the amount of RAM consumed by an app.
Finally we are ready to sign the APK file so we can install it in our Android device. Type the following in your Terminal or Command Prompt
./apksigner sign --ks my-release-key.jks --out [your path]/com.anime.mobile.31/dist/com.anime.mobile.31-release.apk [your path]/com.anime.mobile.31/dist/com.anime.mobile.31-aligned.apk
This command will ask you for the password you entered when generating the private key file. The first APK file listed in the command is the one that will get generated by apksigner utility (com.anime.mobile.31-release.apk) and the second one listed is the one generated by zipalign utility.
Conclusion
Now that you have the signed APK file, just move it to your Android device and proceed with the installation.
Well, that was a lot of steps and it took me several hours to figure everything out and hopefully this guide sped up your endeavor! That being said, I hope you can share this article on your social media pages 🙂
You can follow me on Twitter and GitHub.
Thank you for reading and I hope you enjoyed it. If you have any questions or suggestions let me know in the comments below!
Resources
- Sign your app manually from the command line
- Apktool Documentation
[bottomads][/bottomads]
I want to change the minimum SDK version in Android Studio from API 12 to API 14. I have tried changing it in the manifest file, i.e.,
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="18" />
and rebuilding the project, but I still get the Android Studio IDE throwing up some errors. I presume I have to set the min SDK in ‘project properties’ or something similar so the IDE recognizes the change, but I can’t find where this is done in Android Studio.
Laurel
5,90314 gold badges30 silver badges56 bronze badges
asked Oct 19, 2013 at 10:31
8
When you want to update your minSdkVersion in an existing Android project…
- Update
build.gradle (Module: YourProject)
under Gradle Script and
make sure that it is NOTbuild.gradle (Project: YourProject.app)
.
An example of build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.2"
defaultConfig {
applicationId "com.stackoverflow.answer"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
androidTestCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
- Sync gradle button (refresh all gradle projects also works).
or
- Rebuild project
After updating the build.gradle‘s minSdkVersion
, you have to click on the button to sync gradle file («Sync Project with Gradle files»). That will clear the marker.
Updating manifest.xml, for e.g. deleting any references to SDK levels in the manifest file, is NOT necessary anymore in Android Studio.
Terry
9858 silver badges29 bronze badges
answered Nov 23, 2013 at 21:08
SottiSotti
13.9k2 gold badges50 silver badges43 bronze badges
12
Update 2022
For Android Studio users:
-
Right click the App directory and
Choose the «Open Module Settings» (F4) option
-
Change the «Min SDK Version» in the Default Config tab
NOTE:
You might also want to change;
the «Target SDK Version» in the Default Config tab and
the «Compile SDK Version» in the Properties tab
-
Click Apply, then OK, and Gradle should automatically be synced
For users of older Android Studio versions:
- Right click the App directory and
Choose the «Module Setting» (F4) option - Change the ADK Platform to what you need
- Click OK and Gradle should automatically be synced
Ola Ström
3,5644 gold badges20 silver badges40 bronze badges
answered Feb 10, 2014 at 0:29
user3291001user3291001
1,9191 gold badge11 silver badges3 bronze badges
4
As now Android Studio is stable, there is an easy way to do it.
- Right click on your project file
- Select «Open Module Settings»
- Go to the «Flavors» tab.
- Select the Min SDK Version from the drop down list
PS: Though this question was already answered but Android Studio has changed a little bit by its stable release. So an easy straight forward way will help any new answer seeker landing here.
Isuru
30.1k59 gold badges187 silver badges295 bronze badges
answered Dec 23, 2014 at 19:20
priyankvexpriyankvex
5,6805 gold badges27 silver badges43 bronze badges
5
In android studio you can easily press:
- Ctrl + Shift + Alt + S.
- If you have a newer version of
android studio
, then press on app first.
Then, continue with step three as follows. - A window will open with a bunch of options
- Go to Flavors and that’s actually all you need
You can also change the versionCode
of your app there.
Daniel
451 silver badge9 bronze badges
answered May 13, 2015 at 19:48
Salah KleinSalah Klein
3703 silver badges12 bronze badges
In build.gradle
change minSdkVersion 13
to minSdkVersion 8
Thats all you need to do. I solved my problem by only doing this.
defaultConfig {
applicationId "com.example.sabrim.sbrtest"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
answered Jul 5, 2014 at 13:57
Sabri MevişSabri Meviş
2,1011 gold badge30 silver badges34 bronze badges
According to this answer, you just don’t include minsdkversion in the manifest.xml, and the build system will use the values from the build.gradle file and put the information into the final apk.
Because the build system needs this information anyway, this makes sense. You should not need to define this values two times.
You just have to sync the project after changing the build.gradle
file, but Android Studio 0.5.2 display a yellow status bar on top of the build.gradle editor window to help you
Also note there at least two build.gradle
files: one master and one for the app/module. The one to change is in the app/module, it already includes a property minSdkVersion
in a newly generated project.
answered Apr 15, 2014 at 9:10
MeierMeier
3,8381 gold badge17 silver badges46 bronze badges
For the latest Android Studio v2.3.3 (October 11th, 2017) :
1. Click View
on menu bar
2. Click Open Module Settings
3. Open Flavors
tab
4. Choose Min Sdk
version you need
6. Click OK
AnneTheAgile
9,7566 gold badges50 silver badges48 bronze badges
answered Oct 10, 2017 at 21:32
RidoRido
7174 gold badges10 silver badges22 bronze badges
If you’re having troubles specifying the SDK target to Google APIs instead of the base Platform SDK just change the compileSdkVersion 19
to compileSdkVersion "Google Inc.:Google APIs:19"
answered May 7, 2014 at 18:16
Juan ReyesJuan Reyes
4045 silver badges9 bronze badges
As well as updating the manifest, update the module’s build.gradle
file too (it’s listed in the project pane just below the manifest — if there’s no minSdkVersion
key in it, you’re looking at the wrong one, as there’s a couple). A rebuild and things should be fine…
answered Nov 10, 2013 at 11:44
Chris RollistonChris Rolliston
4,7781 gold badge15 silver badges20 bronze badges
0
In Android studio open build.gradle and edit the following section:
defaultConfig {
applicationId "com.demo.myanswer"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
here you can change minSdkVersion from 12 to 14
nstCactus
5,0032 gold badges30 silver badges41 bronze badges
answered May 20, 2016 at 7:35
File>Project Structure>Modules
you can change it from there
answered Feb 7, 2020 at 18:31
Wisam AtilWisam Atil
811 silver badge9 bronze badges
When you want to change minimum SDK you should take care of minSdkVersion
[About] in module build.garadle
android {
defaultConfig {
minSdkVersion 21
}
}
answered May 30, 2021 at 14:02
yoAlex5yoAlex5
26.5k8 gold badges180 silver badges191 bronze badges
Changing the minSdkVersion in the manifest is not necessary. If you change it in the gradle build file, as seen below, you accomplish what you need to do.
defaultConfig {
applicationId "com.demo.myanswer"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
answered Jul 1, 2016 at 15:10
Chris DeckChris Deck
1462 silver badges9 bronze badges
To change the minimum SDK version in Android Studio just…
1). Right click on «app» in the «Project» panel
2). Choose the new «Min SDK Version» on the «Default Config» tab
3). Click on «OK» and the project will now resync with the new Gradle settings.
answered Sep 7, 2022 at 18:41
SnostorpSnostorp
4687 silver badges12 bronze badges
For me what worked was: (right click)project->android tools->clear lint markers. Although for some reason the Manifest reverted to the old (lower) minimum API level, but after I changed it back to the new (higher) API level there was no red error underline and the project now uses the new minimum API level.
Edit: Sorry, I see you were using Android Studio, not Eclipse. But I guess there is a similar ‘clear lint markers’ in Studio somewhere and it might solve the problem.
answered Oct 27, 2013 at 9:27
Gradle Scripts ->
build.gradle (Module: app) ->
minSdkVersion (Your min sdk version)
answered Jul 12, 2016 at 11:27
I want to change the minimum SDK version in Android Studio from API 12 to API 14. I have tried changing it in the manifest file, i.e.,
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="18" />
and rebuilding the project, but I still get the Android Studio IDE throwing up some errors. I presume I have to set the min SDK in ‘project properties’ or something similar so the IDE recognizes the change, but I can’t find where this is done in Android Studio.
Laurel
5,90314 gold badges30 silver badges56 bronze badges
asked Oct 19, 2013 at 10:31
8
When you want to update your minSdkVersion in an existing Android project…
- Update
build.gradle (Module: YourProject)
under Gradle Script and
make sure that it is NOTbuild.gradle (Project: YourProject.app)
.
An example of build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.2"
defaultConfig {
applicationId "com.stackoverflow.answer"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
androidTestCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
- Sync gradle button (refresh all gradle projects also works).
or
- Rebuild project
After updating the build.gradle‘s minSdkVersion
, you have to click on the button to sync gradle file («Sync Project with Gradle files»). That will clear the marker.
Updating manifest.xml, for e.g. deleting any references to SDK levels in the manifest file, is NOT necessary anymore in Android Studio.
Terry
9858 silver badges29 bronze badges
answered Nov 23, 2013 at 21:08
SottiSotti
13.9k2 gold badges50 silver badges43 bronze badges
12
Update 2022
For Android Studio users:
-
Right click the App directory and
Choose the «Open Module Settings» (F4) option
-
Change the «Min SDK Version» in the Default Config tab
NOTE:
You might also want to change;
the «Target SDK Version» in the Default Config tab and
the «Compile SDK Version» in the Properties tab
-
Click Apply, then OK, and Gradle should automatically be synced
For users of older Android Studio versions:
- Right click the App directory and
Choose the «Module Setting» (F4) option - Change the ADK Platform to what you need
- Click OK and Gradle should automatically be synced
Ola Ström
3,5644 gold badges20 silver badges40 bronze badges
answered Feb 10, 2014 at 0:29
user3291001user3291001
1,9191 gold badge11 silver badges3 bronze badges
4
As now Android Studio is stable, there is an easy way to do it.
- Right click on your project file
- Select «Open Module Settings»
- Go to the «Flavors» tab.
- Select the Min SDK Version from the drop down list
PS: Though this question was already answered but Android Studio has changed a little bit by its stable release. So an easy straight forward way will help any new answer seeker landing here.
Isuru
30.1k59 gold badges187 silver badges295 bronze badges
answered Dec 23, 2014 at 19:20
priyankvexpriyankvex
5,6805 gold badges27 silver badges43 bronze badges
5
In android studio you can easily press:
- Ctrl + Shift + Alt + S.
- If you have a newer version of
android studio
, then press on app first.
Then, continue with step three as follows. - A window will open with a bunch of options
- Go to Flavors and that’s actually all you need
You can also change the versionCode
of your app there.
Daniel
451 silver badge9 bronze badges
answered May 13, 2015 at 19:48
Salah KleinSalah Klein
3703 silver badges12 bronze badges
In build.gradle
change minSdkVersion 13
to minSdkVersion 8
Thats all you need to do. I solved my problem by only doing this.
defaultConfig {
applicationId "com.example.sabrim.sbrtest"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
answered Jul 5, 2014 at 13:57
Sabri MevişSabri Meviş
2,1011 gold badge30 silver badges34 bronze badges
According to this answer, you just don’t include minsdkversion in the manifest.xml, and the build system will use the values from the build.gradle file and put the information into the final apk.
Because the build system needs this information anyway, this makes sense. You should not need to define this values two times.
You just have to sync the project after changing the build.gradle
file, but Android Studio 0.5.2 display a yellow status bar on top of the build.gradle editor window to help you
Also note there at least two build.gradle
files: one master and one for the app/module. The one to change is in the app/module, it already includes a property minSdkVersion
in a newly generated project.
answered Apr 15, 2014 at 9:10
MeierMeier
3,8381 gold badge17 silver badges46 bronze badges
For the latest Android Studio v2.3.3 (October 11th, 2017) :
1. Click View
on menu bar
2. Click Open Module Settings
3. Open Flavors
tab
4. Choose Min Sdk
version you need
6. Click OK
AnneTheAgile
9,7566 gold badges50 silver badges48 bronze badges
answered Oct 10, 2017 at 21:32
RidoRido
7174 gold badges10 silver badges22 bronze badges
If you’re having troubles specifying the SDK target to Google APIs instead of the base Platform SDK just change the compileSdkVersion 19
to compileSdkVersion "Google Inc.:Google APIs:19"
answered May 7, 2014 at 18:16
Juan ReyesJuan Reyes
4045 silver badges9 bronze badges
As well as updating the manifest, update the module’s build.gradle
file too (it’s listed in the project pane just below the manifest — if there’s no minSdkVersion
key in it, you’re looking at the wrong one, as there’s a couple). A rebuild and things should be fine…
answered Nov 10, 2013 at 11:44
Chris RollistonChris Rolliston
4,7781 gold badge15 silver badges20 bronze badges
0
In Android studio open build.gradle and edit the following section:
defaultConfig {
applicationId "com.demo.myanswer"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
here you can change minSdkVersion from 12 to 14
nstCactus
5,0032 gold badges30 silver badges41 bronze badges
answered May 20, 2016 at 7:35
File>Project Structure>Modules
you can change it from there
answered Feb 7, 2020 at 18:31
Wisam AtilWisam Atil
811 silver badge9 bronze badges
When you want to change minimum SDK you should take care of minSdkVersion
[About] in module build.garadle
android {
defaultConfig {
minSdkVersion 21
}
}
answered May 30, 2021 at 14:02
yoAlex5yoAlex5
26.5k8 gold badges180 silver badges191 bronze badges
Changing the minSdkVersion in the manifest is not necessary. If you change it in the gradle build file, as seen below, you accomplish what you need to do.
defaultConfig {
applicationId "com.demo.myanswer"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
answered Jul 1, 2016 at 15:10
Chris DeckChris Deck
1462 silver badges9 bronze badges
To change the minimum SDK version in Android Studio just…
1). Right click on «app» in the «Project» panel
2). Choose the new «Min SDK Version» on the «Default Config» tab
3). Click on «OK» and the project will now resync with the new Gradle settings.
answered Sep 7, 2022 at 18:41
SnostorpSnostorp
4687 silver badges12 bronze badges
For me what worked was: (right click)project->android tools->clear lint markers. Although for some reason the Manifest reverted to the old (lower) minimum API level, but after I changed it back to the new (higher) API level there was no red error underline and the project now uses the new minimum API level.
Edit: Sorry, I see you were using Android Studio, not Eclipse. But I guess there is a similar ‘clear lint markers’ in Studio somewhere and it might solve the problem.
answered Oct 27, 2013 at 9:27
Gradle Scripts ->
build.gradle (Module: app) ->
minSdkVersion (Your min sdk version)
answered Jul 12, 2016 at 11:27
13 ответов
Если вы хотите обновить minSdkVersion в существующем проекте…
- Обновить
build.gradle(Module: app)
. Убедитесь, что он находится под Gradle Script, и он НЕbuild.gradle(Project: yourproject)
.
Пример build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.stackoverflow.answer"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
androidTestCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
- Кнопка синхронизации gradle (обновлены все проекты gradle)
- Реконструкция проекта
После обновления build.gradle minSdkVersion
вам нужно щелкнуть по кнопке, чтобы синхронизировать файл gradle ( «Синхронизировать проект с gradle файлами» ). Это очистит маркер.
Обновление manifest.xml, например. удаление каких-либо ссылок на уровни SDK в файле манифеста больше не требуется в Android Studio.
Sotti
23 нояб. 2013, в 22:19
Поделиться
Для пользователей студии Android:
- щелкните правой кнопкой мыши каталог приложения
- выберите параметр «настройка модуля»
- измените платформу ADK как то, что вам нужно
- Нажмите «Применить»
gradle автоматически перестроит проект.
user3291001
10 фев. 2014, в 01:05
Поделиться
Как сейчас Android Studio стабильна, есть простой способ сделать это.
- Щелкните правой кнопкой мыши файл проекта
- Выберите «Открыть настройки модуля»
- Перейдите на вкладку «Ароматизаторы».
- Выберите Min SDK Version из выпадающего списка
PS: Хотя на этот вопрос уже был дан ответ, но Android Studio немного изменила его стабильный выпуск. Таким образом, простой прямой способ поможет любому новому поиску ответа приземлиться здесь.
priyankvex
23 дек. 2014, в 19:35
Поделиться
В студии Android вы можете легко нажать:
- Ctrl + Shift + Alt + S.
- Если у вас есть более новая версия
android studio
, чем сначала нажмите на приложение.
чем продолжить с шага 3 следующим образом. - Откроется окно с набором параметров
- Перейдите в Flavors, и на самом деле все, что вам нужно
Вы также можете изменить versionCode
вашего приложения.
Salah Klein
13 май 2015, в 20:51
Поделиться
В build.gradle
измените minSdkVersion 13
на minSdkVersion 8
. Это все, что вам нужно сделать. Я решил свою проблему, только делая это.
defaultConfig {
applicationId "com.example.sabrim.sbrtest"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
Sabri Meviş
05 июль 2014, в 15:01
Поделиться
В соответствии с этим ответом вы просто не включаете minsdkversion в файл manifest.xml, а система сборки будет использовать значения из файла build.gradle и поместите информацию в окончательный apk.
Поскольку система сборки нуждается в этой информации, это имеет смысл. Вам не нужно указывать эти значения два раза.
Вам просто нужно синхронизировать проект после изменения файла build.gradle
, но Android Studio 0.5.2 отображает желтую строку состояния поверх окна редактора build.gradle, чтобы помочь вам
Также обратите внимание на наличие как минимум двух файлов build.gradle
: один мастер и один для приложения/модуля. Тот, который нужно изменить, находится в приложении/модуле, он уже включает свойство minSdkVersion
во вновь сгенерированном проекте.
Meier
15 апр. 2014, в 09:38
Поделиться
Если у вас возникли проблемы с указанием целевой SDK для API Google вместо базового пакета SDK, просто измените compileSdkVersion 19
на compileSdkVersion "Google Inc.:Google APIs:19"
Juan Reyes
07 май 2014, в 18:16
Поделиться
Также, как и обновление манифеста, обновите файл модуля build.gradle
тоже (он указан в панели проекта чуть ниже манифеста — если там нет minSdkVersion
), вы смотрите на неправильный, так как там пара). Перестроить и все должно быть хорошо…
Chris Rolliston
10 нояб. 2013, в 13:25
Поделиться
Для последней версии Android Studio v2.3.3 (11 октября 2017 года):
1. Нажмите View
в строке меню
2. Нажмите «Открыть настройки модуля»
3. Откройте вкладку Flavors
4. Выберите Min Sdk
версию, которая вам нужна
6. Нажмите OK
Rido
10 окт. 2017, в 22:14
Поделиться
Gradle Скрипты →
build.gradle(модуль: приложение) → minSdkVersion (Your min sdk version)
Hubert Hubert
12 июль 2016, в 11:32
Поделиться
Изменение minSdkVersion в манифесте не требуется. Если вы измените его в файле сборки gradle, как показано ниже, вы выполните то, что вам нужно сделать.
defaultConfig {
applicationId "com.demo.myanswer"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
Chris
01 июль 2016, в 15:58
Поделиться
В студии Android откройте build.gradle и отредактируйте следующий раздел:
defaultConfig {
applicationId "com.demo.myanswer"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
здесь вы можете изменить minSdkVersion от 12 до 14
Dharmendra Pratap
20 май 2016, в 08:00
Поделиться
Для меня работал: (щелчок правой кнопкой мыши) project- > инструменты android- > clear lint markers. Хотя по какой-то причине Manifest вернулась к старому (более низкому) уровню API, но после того, как я изменил ее на новый (более высокий) уровень API, не было подчеркивания красной ошибки, и теперь проект использует новый минимальный уровень API.
Изменить: Извините, я вижу, что вы использовали Android Studio, а не Eclipse. Но я думаю, что в Studio есть похожие «четкие метки метки», и это может решить проблему.
Jamppa
27 окт. 2013, в 10:58
Поделиться
Ещё вопросы
- 0манипулировать размером шрифта модуля HTML () в блокноте ipython
- 0HTML — сделать так, чтобы указатель мыши над div влиял на несколько div?
- 1ListView из нескольких таблиц?
- 1минута даты JavaScript с ведущим нулем
- 0Получить приложение для входа в систему, MFC
- 0Отображение пикселей глубины в цвет пикселей
- 0Правильный способ в PHP для форматирования / экранирования строки для использования в XML
- 0SQL Row_number () Repeat
- 0Найти шаблон по двум строкам, а затем измерить время между MYSQL
- 0Поиск конкретного магазина с eBay API
- 1Перезапустить приложение с намерения
- 1HTML5 — проверка
- 1Python3: как получить все квадраты и кубики равными или меньшими числа
- 0Symfony, Doctrine, merge не работают должным образом (в то время как сохраняются те же сущности)
- 1Изменить результат вывода np.array
- 0при изменении класса клика
- 0php выдает ошибку no no timezone при новой настройке
- 1Python Pandas — Найти первый экземпляр значения, превышающего порог
- 0вложенные контроллеры, родительский доступ и синтаксис controllerAs
- 1Не удается загрузить и загрузить файлы из облачного хранилища Google при развертывании
- 0Запрет обратной передачи из угловой директивы
- 1Как извлечь значения Rid и SID из соединения Strophe?
- 1Буферизация / синхронизация нескольких аудиопотоков в JavaScript
- 1Хорошо ли я обрабатываю ошибки с помощью функций async / await и Mongoose?
- 0Угловая фильтрация по значению поля
- 0AngularJs ng-repeat не обновлялся после изменения переменной $ scope
- 1Python: numpy, pandas и выполнение операций над предыдущим значением массива (сглаженные средние): есть ли способ не использовать цикл FOR? EWMA?
- 0Использование SWIG для возврата Byte [], вызывающего jvm для segv при выходе
- 1Как заставить запрос службы Windows ждать до завершения предыдущего запроса
- 0Проект с несколькими выходами DLL
- 1Получение ConnectionProvider из SessionFactory
- 0STRICT MODE -> Изменена структура контроллера, получая «ключ не определен» в цикле For In
- 0Angular JS, ошибка: [$ injector: nomod] Модуль ‘blogger.posts.controllers’ недоступен
- 0Как установить идентификатор и имя с автозаполнением
- 1Как получить доступ к 64-битной библиотеке JNI с помощью 32-битной Java 8 Embedded JRE
- 1Python очищает данные онлайн, но CSV-файл не показывает правильный формат данных
- 1Функция простой практики отображает NaN
- 1Экспресс-роутер: id
- 0получение среднего значения частей изображения
- 0Необработанное исключение в (адрес памяти) (msvcr110.dll)
- 1Hibernate Search Ассоциация со свойством IndexEmbedded с составным идентификатором
- 0JavaScript, если () не работает
- 1Получение странного поведения при получении данных из Microsoft CRM с использованием LINQ
- 1получить подстроку между {и}
- 1Строка в Integer не работает
- 0Как использовать curl вместо fopen для отправки данных в URL
- 0c ++ получает значения по одному из файла
- 1В Spark RDD являются неизменяемыми, тогда как реализованы аккумуляторы?
- 1Словарь выражения Linq [дубликаты]