如何构建应用程序以支持Android中的旧SDK版本(minSdkVersion)
当通过向导创建新项目并给出错误消息时,它是如此沮丧.
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文件
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'
As you can find out in the releases notes for 26.0.0 here
注意:SDK的最低版本已增加到14.因此, 许多仅用于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.