简体   繁体   English

清单合并失败:uses-sdk:minSdkVersion 8不能更小

[英]Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller

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.. 谢谢你,先生..

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,并且您选择使用的Google SDK服务要求的SDK为9。

Change the line " minSdkVersion 8 " to " minSdkVersion 9 ". 将行“ minSdkVersion 8 ”更改为“ minSdkVersion 9 ”。 So, save it . 因此, 保存它

After, Clean Project and Rebuild it . 之后, 清理项目重建它

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版本

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 现在工作正常

<uses-sdk tools:overrideLibrary="your pkg name of libary with conflict" />

并在AndroidManifest.xml中添加xmlns:tools =“ http://schemas.android.com/tools”

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 And​​roid Studio的android/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
    }
}
...

You can run the simply following command. 您可以运行以下简单命令。

cordova build android -- --minSdkVersion=15

It will work for you. 它将为您工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM