2016-03-15 47 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