如何在android中构建支持旧SDK版本(minSdkVersion)的应用程序 [英] How to build app supports Old SDK Versions (minSdkVersion) in android
问题描述
当通过向导创建新项目并出现错误时,它非常沮丧.
When creating new project by wizard and gives errors, then it is so frustrated.
我只是用 MinSdk = 9 创建了一个新项目,让应用程序在姜饼上运行这给了我以下错误:
I just create new project with MinSdk = 9 to make the app run on gingerbread this gives me the following Error:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library [com.android.support:appcompat-v7:26.0.0-alpha1] C:\Users\USER\.android\build-cache\dfb3187f39ea1ff94009f5d34353fff5cfc3daee\output\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage
这里是gradle文件
and here is the gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.com.testApp"
minSdkVersion 9
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
testCompile 'junit:junit:4.12'
}
如何解决这个问题?
推荐答案
您必须使用旧版本的支持库.
You have to use the older version of the support library.
compileSdkVersion 25
compile 'com.android.support:appcompat-v7:25.4.0'
您可以在 26.0.0 的发行说明中找到 这里
As you can find out in the releases notes for 26.0.0 here
注意:最低 SDK 版本已增加到 14.因此,许多 API 只存在于 API <14 兼容性已已弃用.这些 API 的客户端应该迁移到他们的框架每个已弃用 API 的参考页面中注明的等效项.
Note: The minimum SDK version has been increased to 14. As a result, many APIs that existed only for API < 14 compatibility have been deprecated. Clients of these APIs should migrate to their framework equivalents as noted in the reference page for each deprecated API.
这篇关于如何在android中构建支持旧SDK版本(minSdkVersion)的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!