2016-03-15 46 views
0

使用下面的gradle脚本,我想知道如何将minSdkVersion从7更改为3(这样我的应用程序就可以在更多设备上运行),而不会在此帖子底部发现错误:minSDKVersion的清单合并失败

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

...然后我会得到以下错误:

错误:执行失败的任务 ':应用程序: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

...这就是说,它甚至有可能到我的最低SDK降低到3(1.5,蛋糕版)如果我想发表我与谷歌Play应用程式?而且,在你想知道的话,我还下载了Android支持库在SDK管理器如下,但它仍然无法正常工作:

enter image description here

谢谢!

回答

2

该错误是告诉你由于该库无法支持任何低于7,你的图书馆之一(在这种情况下,程序兼容性)只支持回SDK版本7,您使用该库,你可以不支持任何东西低于7

你的选择要么是:

  • 删除程序兼容性
  • 支持的最低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?

绝对。你可以上传一个Android应用程序支持API级别1,如果你真的想。

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

+0

伟大的答案帮助。 * Upvoted * – DaveNOTDavid