difference between compileSdkVersion and buildToolsVersion in android studio..? - android

hiii
i'm new in android development.Can anyone tell me what is compileSdkVersion and
buildTollsVersion defined in build tools version.
compileSdkVersion 24
buildToolsVersion "23.0.3"
is this a correct definition..?
if not then what it will cause..?
please help
thank you

compileSdkVersion is the API version of Android that you compile against.
buildToolsVersion is the version of the compilers (aapt, dx, renderscript compiler, etc...) that you want to use. For each API level (starting with 18), there is a matching .0.0 version.

Related

Can i set targetSDK lesser than buildToolsVersion & compileSdkVersion

I have upgraded google-play-services to 15.0.0, that uses android.support:26.1.0, so i am planning to upgrade compileSdkVersion and buildToolsVersion to version 26.
But there are some external libraries(.aar libraries) that requires targetSdkVersion to be set to version 25.
So if i set compileSdkVersion to 26 and buildToolsVersion to "26.0.0" and keep targetSdk to version 25, then what will happen
AFAIK, targetSdkVersion should be <= compileSdkVersion. As the Android Framework Developer said in this blog, ideally to have a steady state this should be the relationship of the compileSdkVersion, minSdkVersion, and targetSdkVersion:
minSdkVersion (lowest possible) <=
targetSdkVersion == compileSdkVersion (latest SDK)
Hope this helps.

I've two different react native packages which require different android compileSdkVersion, how do I fix this?

I use react-native-music-control and react-native-navigation(by wix) , rnmc requires compilesdkversion 23 and buildToolsVersion '23.0.1' whereas rnn requires compilesdkversion 25 and buildToolsVersion '25.0.0', rnn does not work with 25.0.0/25 and rnn won't work with 23/23.0.1 . I don't have much experience with android so I'm not sure how to fix this, any guidance would be great.
Add the following to build.gradle in your projects root directory
subprojects {
afterEvaluate {
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
targetSdkVersion 25
}
}
}
}

Gradle asks for nonexistent support library version

Recently I've been getting this problem.
As far as I know, there is no 26.X.X versions of these support libraries, what does Gradle wants from me?
After reviewing a previous question, you may want to be sure that your compileSdkVersion matches across the board, if you want to build in 25 but you are in 23.
This support library should not use a different version Error in build.gradle
You can confirm versions by >> Create new project in Android studio >> Press Ctrl+Shift+Alt+S >> Proceed to 'Project' section >> You can see actual gradle version and android pluging version. Copy that to your project.
The problem lies in your Compile version in build.gradle file.
It seems, your compile version is 26.
Please change your compile version to 25 and sync gradle.
compileSdkVersion 25
buildToolsVersion "25.0.3"
Please set your Compile Version to 25
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.user.xxxxx"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
}

Android Studio 2.0 Preview 2 issue with Renderscript

I updated Android Studio to 2.0 Preview 2, then I got an error Renderscript support mode is not currently supported with renderscript target 21+
I'm using renderscriptTargetApi 23
Renderscript isn't currently supported with Target 21+ so simply change the target to API 20 and that should solve the error. So the renderscript related options in your default config section of your gradle file should like :
renderscriptTargetApi 20
renderscriptSupportModeEnabled true
The bug related to renderscriptTargetApi has been fixed in gradle-plugin 2.1.0 and Build-Tools 23.0.3.
Please try it out:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
...
}
#atabouraya,
This is bug in build tools. Please check your build tools version and if is lower than 23.0.3, update them.
More info here:
http://developer.android.com/intl/es/tools/revisions/build-tools.html
in Build Tools, Revision 23.0.3 (March 2016)
#atabouraya,
There need to be change in build.gradle of your app
as suggested from android developer site.
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
renderscriptTargetApi 18
renderscriptSupportModeEnabled true
}
}
Just change renderscriptTargetApi 23 to renderscriptTargetApi 20, and make sure your minSdkVersion less than 21.

How to prevent Android Studio from generating signed APK success if I were using wrong API level

Currently, I have a project with min SDK API level 10.
In my code, I had accidentally use function which requires API level 19.
Previously, if I were using Eclipse, it will prevent me from building APK successfully.
However, after switching to Android Studio 1.0, it doesn't prevent me from generating signed APK? Note, I didn't use #SuppressLint("NewApi") for that paritcular function.
Is there any way I can enforce Android Studio 1.0, to prevent such mistake?
As you can see in my Android Studio screenshot, although I had enforced "Calling new methods on older version as error", it doesn't prevent my from building APK.
My build.gradle looks like this
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "org.myproject.gui"
minSdkVersion 10
targetSdkVersion 19
}
...
Note, I can see an actual lint warning in my editor
I even try to add the following line in my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "org.myproject.gui"
minSdkVersion 10
targetSdkVersion 19
}
...
// This is important to prevent programmer mistake?!
lintOptions {
abortOnError true
}
But, that doesn't prevent me from Generate Signed APK... successfully.

Categories

Resources