I am working on android app. Can anybody tell me that how can we restrict our app installation in android version less than 4.0 from google play developer console.
This is not set in Google Play developer console, it is set in the project's build gradle.
The setting is in build.gradle file in your application module. There should be something like this.
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
change minSdkVersion to whatever value of sdk you want to support.
Read more here: https://developer.android.com/studio/publish/versioning.html#minsdkversion
And here are the sdk int value for each Android version: https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels
There is no way that I know of to manage that in Developer Console. You should upload binary that was packaged with Minimum Android Version set in AndroidManifest.xml to what ever is the minimum you still want to support (4.0 in your case).
Example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="14" />
</manifest>
14 is the API Level of Android 4.0.
so i reinstalled linux on my computer and after i reinstalled android studio i tried getting an app that i wrote on to my phone which previously had not been a problem. The App ist targeted at devices with API 16 or higher but apparently Android Studio now features something called N preview which does not let me run anything on my phone. specifically when i hit the run button it tells me that
minSdk(API 23, N) != device Sdk(API 22)
i know this seems as though the target API isnt set correctly but when i started the project i set it to 16. Now how do i get around this? Also whats the cleanest way to change the target API on a project? Do i just change the build gradle?
Thanks a lot!
app gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-N'
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.josias.myapplication"
minSdkVersion 16
targetSdkVersion 'N'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.+'}
Change
compileSdkVersion 'android-N' to compileSdkVersion 22 and targetSdkVersion 'N' to targetSdkVersion 22
The same happened to me on Android Studio, so I could not start a new emulator.
I had to:
Gradle Scripts -> build.gradle (module:app) -> minSdkVersion 14
(update "minSdkVersion" value to "14".
Now I am able to start a new emulator.
See the explain of CommonsWare. The key point is a preview version, so
older level device was prevented to install app anyway when using N compileSdkVersion.
This wortk for me in Android Studio: hold ctl+alt+shift press 'S', This will open project structure. Click on the tab 'Flavors', check in min sdk version if appear a version of your device sdk if you see select it and click 'OK', but if you didn't see a option for your sdk device click on cancel. Go to build.gradle(app) file and type in the min sdk version the version of your sdk device(android studio will recomend you to intall the version sdk). After that hold ctl+alt+shift press 'S' and the version sdk min will be there, just select it and click 'ok'. :)
check your build.gradle file to ensure the proper min sdk is set...android studio overrides the manifest with the build.gradle
I renctly encountered this problem, and this is very strange, on the other thread there's people suggest you should change you usb setting to "MTP/FTP" or something, this doesnt make sense and dont work out on my case.
After search some example case in this problem, I found that most of people have this problem when minSDK/'targetSDK'/'compileSdkVersion' is not a int but a letter.
I changed my MNC/N' to 23, andbuild - clean build`, problem solved.
hope it can help someone.
Change the minSdkVersion to your target device sdkVersion in build.gradle(Module:app)file will be appear on left side in Gradle Scripts.. Ex: minSdkVersion 24 //change the version value to ur target device value(like 23 or 22 or 21 or etc)
According to your configuration you have to change the minSdkVersion 23 to minSdkVersion 22, becoz your target device at API LEVEL 1
you can do a thing just open the sdk manager since i had one and just install ,the Ă„NDROID N (API 23 N PREVIEW PACKAGES) give it a try instead of changing the gradle files
Changing the minSdkVersion may not always help. Check your SDK Manager, as already suggested, and make sure that you have the necessary versions installed as well (I had changed mine in Gradle, but it only made things worse on my end).
I am asking this to make my understanding clear about this. Currently, I have developed few android apps using eclipse. Now I have switched to Android studio and the very first thing I observed is that my manifest file doesn't have
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="9" />
which I had in eclipse, instead I have this in my build.gradle(Module: app) in AS.
defaultConfig {
applicationId "com.example.testing"
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
So my question is : is this info added to manifest later and if not, then how the app will recognize its min and target sdk. I am little confused with the structure in AS.
Yes, the value inside your build.gradle will be added to the manifest when you'll be launching your app. In fact even if you add manually sdk parameter in the manifest, it will be overridden by the gradle value !
It seems that the manifest shown in the explorer is like a preview of the final manifest.
I started to learn android using Android Studio 0.8.2 and I started a new project with the minimum API as 15. But in my AndroidManifest.xml, doesn't appear the uses-sdk tag.
Do I have to insert it by myself? Shouldn't the project create it? Or is Android Studio different and is no longer necessary to insert this in manifest, only in the build.gradle?
Thank you in advance :)
The default template in Android Studio is ready to work with gradle.
If you check your project you will find a build.gradle file inside your app module.
Here you can find something like this:
defaultConfig {
applicationId 'xxxx'
minSdkVersion 15 //your minSdk
targetSdkVersion XX //your targetVersion
versionCode 0
versionName '0.1.0'
}
Gradle building the project will override the uses-sdk tag in your Manifest.
Yes, add it manually.
Android studio uses build.gradle to build the project so it doesn't care about the manifest, and that's probably why it doesn't insert it in it. However, it is important to have it in the manifest, for when you publish the app, as Google play uses this for filtering the devices.
I have an app that works fine on API 19. However, I want it to work well in other API's as well. I'm targeting API 10 and above.
My gradle build looks like this:
android {
compileSdkVersion 18
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 18
}
}
But when I run the app on API 10 the AVD manager says compatible: no
How should I change my build so that it is compatible for API 10 and above?
Your gradle config looks correct. Be sure to check your virtual device settings and compare to what you have defined in your manifest file. Also be sure to check any other modules you may have added to the project and their respective gradle and manifest files.