通过以下 gradle 脚本,我想知道如何将 minSdkVersion 从 7 更改为 3(这样我的应用程序就可以在更多设备上运行),而不会在本文底部出现错误:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "dpark.cellular_automata"
minSdkVersion 3
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
}
...然后我会收到以下错误:
错误:任务“:app:processDebugManifest”执行失败。
Manifest merger failed : uses-sdk:minSdkVersion 3 cannot be smaller than version 7 declared in library [com.android.support:appcompat-v7:23.0.1] C:\Users\Dave\AndroidStudioProjects\Cellular_Automata\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.1\AndroidManifest.xml Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage
...也就是说,如果我想通过 Google Play 发布我的应用程序,是否可以将最低 SDK 降低到 3(版本 1.5,Cupcake)?另外,如果您想知道,我还在 SDK 管理器中下载了 Android 支持库,如下所示,但它仍然不起作用:
谢谢!
最佳答案
该错误告诉您,您的一个库(在本例中为 AppCompat)仅支持 SDK 版本 7。由于该库无法支持低于 7 的任何版本,并且您使用该库,因此您无法支持任何低于版本的版本超过 7。
您的选择是:
- 删除 AppCompat
- 至少支持 API 级别 7。请注意 SDK version 8 currently has less than 0.1%全局市场份额中,8 个以下的所有版本加起来为 1%。这可能不值得你花时间。
That said, is it even possible to lower my minimum SDK to 3 (version 1.5, Cupcake) if I wanted to publish my app with Google Play?
绝对是的。如果您确实愿意,可以上传支持 API 级别 1 的 Android 应用程序。
And also, in case you're wondering, I also downloaded the Android Support Library in the SDK manager as follows, and yet it still doesn't work:
支持库 v4 仅支持 API 级别 4,因此我不确定这对支持 API 级别 3 有什么帮助。
关于java - minSDKVersion 的 list 合并失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36016256/