I help friend with fixing some bugs in application. Developer that send previous version set targetSdkViersion to 23 and Google Developer Console shows error that I cant lower it 19. Problem is, than our app works well with this build configuration without any changes in code:
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.swiatkarpia.mobileapp"
minSdkVersion 14
targetSdkVersion 19
versionCode 15
versionName "1.5"
...
compile 'com.android.support:support-v4:21.0.3'
compile 'com.google.android.gms:play-services:6.1.+'
It uses Youtube API and Google Maps API (old versions) and propably this causes the problem.
Is there any way to bypass Google's error?
Unfortunately, once you uploaded a version with taget sdk 23, you will not be able to lower the target sdk in any future versions.
Related
When I am trying to compile with following configuration in base feature,
compileSdkVersion 25
targetSdkVersion 25
I get the below error message
"Feature modules require compileSdkVersion set to 26 or higher. compileSdkVersion is set to 25"
Is there a relation between compileSdkVersion and targetSdkVersion of instant app and installable app ? Please help.
You need a compileSdkVersion of 26. You should always use the highest possible value for compileSdkVersion and targetSdkVersion. This does not affect backward compatibility. Moreover, Google requires current values for uploading to Google Play.
everyone!
I'm new to android programming, so simple things sometimes become a problem.
I have my application. It should work on devices with Android 5 and higher.
The question is what is proper strategy of sdkVersion defining?
What I mean.
For example, I need to acheive permision to use bluetooth.
If my target sdkVersion is 7 and minimum sdkVersion is 5 I should ask permission in manifest file and then acheive it in runtime. Like this
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
...
}
But if my target sdkVersion is 5 even Build.VERSION_CODES.M cannot be resolved.
So the question is : what is proper approach to choose sdkVersion? Where can I read about it?
I read here https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#target
but I didn't get what is best practice. So please share your experience.
Read this article from Ian Lake: Picking your compileSdkVersion, minSdkVersion, and targetSdkVersion
compileSdkVersion:
compileSdkVersion is your way to tell Gradle what version of the
Android SDK to compile your app with. Using the new Android SDK is a
requirement to use any of the new APIs added in that level.
minSdkVersion:
If compileSdkVersion sets the newest APIs available to you,
minSdkVersion is the lower bound for your app. The minSdkVersion is
one of the signals the Google Play Store uses to determine which of a
user’s devices an app can be installed on.
targetSdkVersion:
The most interesting of the three, however, is targetSdkVersion.
targetSdkVersion is the main way Android provides forward
compatibility by not applying behavior changes unless the
targetSdkVersion is updated. This allows you to use new APIs (as you
did update your compileSdkVersion right?) prior to working through the
behavior changes.
Ideally, the relationship would look more like this in the steady state:
minSdkVersion (lowest possible) <=
targetSdkVersion == compileSdkVersion (latest SDK)
I suppose you are using Android Studio and build.gradle. If not, I recommend you to get it. All of the following is relevant for Android Studio and gradle build system.
Your main mistake is that SDK version in build.gradle of app module is not the same as Android Version. Here is the list of Platform Codenames, Versions, API Levels. What you need for SDK version is number in API level column of first table.
This is how android section of build.gradle for app targeting Android 5.0 and newer should look like.
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "net.eraga.myobjectives"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
Read more about targetSdkVersion, minSdkVersion and compileSdkVersion here.
In this case, your minSdkVersion should be 21 (android 5.0) and targetSdkVersion along with compileSdkVersionshould be 25 (android 7.1).
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.abc.ege"
minSdkVersion 16
targetSdkVersion 25
versionCode 3
versionName "1.1.3"
vectorDrawables.useSupportLibrary = true
}
}
Although my target sdk version is 25, when I upload the apk to play store, it says "not compatible with devices with android version 4.4 and over, where is the problem?
edit: app works fine on emulators and there is no hardware access in manifest file
I think you should lowerize targetSdkVersion to 24, as 25 (7.1) is not released yet.
Solved the issue. Looks like an external library's android manifest file maxSDK is set to 19.
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.
Please help me regarding developing android app. If I developed that app upon API 21 or 23 then Is it run?
You don't need that version of build tool.
In the build.gradle, set minSdkVersion or targetSdkVersion (or both) to API-17. For your case below is recommended:
defaultConfig {
...
minSdkVersion 17
targetSdkVersion 23
...
}