Java 清单合并失败:uses-sdk:minSdkVersion 8 不能更小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24718824/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller
提问by user1438799
The problem is..
问题是..
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1
清单合并失败:uses-sdk:minSdkVersion 8 不能小于库 com.android.support:support-v4:21.0.0-rc1 中声明的版本 L
The code in build.gradle
build.gradle 中的代码
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.androidexample.gcm"
minSdkVersion 8
targetSdkVersion 16
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:+'
compile 'com.google.android.gms:play-services:+'
//compile 'com.android.support:support-v4:20.0.0'
//compile 'com.google.android.gms:play-services:5.0.77'
}
Code in the AndroidManifest is ..
AndroidManifest 中的代码是..
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidexample.gcm"
android:versionCode="1"
android:versionName="1.0" >
<!-- GCM requires Android SDK version 2.2 (API level 8) or above. -->
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<!-- Main activity. -->
<application
android:name="com.androidexample.gcm.Controller"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<!-- Register Activity -->
<activity
android:name="com.androidexample.gcm.RegisterActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.DELETE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="com.idrivecare.familypro" />
</intent-filter>
</activity>
<!-- Main Activity -->
<activity
android:name="com.androidexample.gcm.MainActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name" >
</activity>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.androidexample.gcm" />
</intent-filter>
</receiver>
<service android:name="com.androidexample.gcm.GCMIntentService" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
</application>
<!-- GCM connects to Internet Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Creates a custom permission so only this app can receive its messages. -->
<permission
android:name="com.androidexample.gcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.androidexample.gcm.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- Network State Permissions to detect Internet status -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Permission to vibrate -->
<uses-permission android:name="android.permission.VIBRATE" />
</manifest>
Thank you sir..
谢谢你,先生..
采纳答案by Marco Acierno
If you use
如果你使用
'com.android.support:support-v4:+'
It will suppose it can use 21.x since is the latest version (but not compatible with target less than L)
它会假设它可以使用 21.x,因为它是最新版本(但与小于 L 的目标不兼容)
Change it to
将其更改为
'com.android.support:support-v4:20.+'
So it will download the latest 20.x version
所以它会下载最新的 20.x 版本
回答by AlamoPS
The problem is because your app min sdk is 8 and you selected to use the Google Plus services that requires min sdk 9.
问题是因为您的应用程序最小 sdk 为 8,而您选择使用需要最小 sdk 9 的 Google Plus 服务。
Change the line "minSdkVersion 8" to "minSdkVersion 9". So, save it.
将“ minSdkVersion 8”行更改为“ minSdkVersion 9”。所以,保存它。
After, Clean Projectand Rebuild it.
之后,清理项目并重建它。
回答by Red Cricket
I had to change the my libGDX Android Studio's android/build.gradle
file so it looked like this when I wanted to integrate Amazon Mobile Ads library.
我不得不更改我的 libGDX Android Studioandroid/build.gradle
文件,因此当我想集成 Amazon Mobile Ads 库时它看起来像这样。
android {
buildToolsVersion "23.0.3"
compileSdkVersion 23
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
instrumentTest.setRoot('tests')
}
defaultConfig {
applicationId "com.foo.bar"
// RBC minSdkVersion 8
minSdkVersion 9
targetSdkVersion 23
}
}
...
回答by kiranvarma
In my case I changed the code {minSdkVersion 8} inside build.gradle file to {minSdkVersion 9}
就我而言,我将 build.gradle 文件中的代码 {minSdkVersion 8} 更改为 {minSdkVersion 9}
defaultConfig { applicationId "com.example.npeducations.week1_lab" minSdkVersion 9 targetSdkVersion 23 versionCode 1 versionName "1.0" }
Now it works fine
现在它工作正常
回答by Tabish
You can run the simply following command.
您可以运行以下简单的命令。
cordova build android -- --minSdkVersion=15
It will work for you.
它会为你工作。
回答by Makvin
<uses-sdk tools:overrideLibrary="your pkg name of libary with conflict" />
and add xmlns:tools="http://schemas.android.com/tools" in AndroidManifest.xml
并在 AndroidManifest.xml 中添加 xmlns:tools="http://schemas.android.com/tools"