我已经有一个支持pre-lollipop设备的Android应用程序,但我想移植Android应用程序以支持最新版本到Marshmallow和早期版本到Jellybean,是否有任何特定指南可用于支持上述标准?
In your manifest/build.gradle:(depending on what you use)
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="23" />
Gradle:
defaultConfig {
........
minSdkVersion 14
targetSdkVersion 23
}
Set the minSDK to as low as possible. If it is too low, it will show an error. Remember that if you are using any code that requires higher API levels(eg when writing xml only writing android:layout_marginStart
that requires API 17) you get an error telling you to increase min API level. Now, there are some ways to avoid increasing;
android:layout_marginRight
To summarize:
When coding XML, use code that supports old and new(if available). When doing normal coding, attempt to use code that supports older versions and new that aren't deprecated. If possible use AppCompat to get new code and new things on old devices.
You can change your support version from gradle file like this
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1"
multiDexEnabled true
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.