gpt4 book ai didi

android - 如何构建应用程序支持Android中的旧SDK版本(minSdkVersion)

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:26:31 26 4
gpt4 key购买 nike

当通过向导创建新项目时出现错误,那真是太令人沮丧了。

我只是用 MinSdk = 9 创建新项目,让应用程序在 gingerbread 上运行这给了我以下错误:

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'
}

如何解决这个问题?

最佳答案

您必须使用旧版本的支持库。

compileSdkVersion 25

compile 'com.android.support:appcompat-v7:25.4.0'

您可以在 26.0.0 的发行说明中找到 here

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 - 如何构建应用程序支持Android中的旧SDK版本(minSdkVersion),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44604854/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com