Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared

问题完整描述:Error:Execution failed for task ‘:app:processDebugManifest’.

Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library [com.google.android.gms:play-services-appindexing:8.1.0] D:\work_irr\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-appindexing\8.1.0\AndroidManifest.xml
Suggestion: use tools:overrideLibrary=”com.google.android.gms.appindexing” to force usage

这个问题产生的具体原因我也不清楚,在我编译的时候莫名出现的,一头雾水的搞了很久,最后终于解决了,记下了,方便遇到同类问题的童鞋。(注:以下解决方案不一定适合所有人,但是我是这么解决的)

方法一
根据Log日志提示,大概是因为sdk最小版本过低,小于9,所以只要改9大的版本即可,当然还需要更改build.gradle 配置文件,具体操作如下:
(1)、AndroidManifest.xml
我的之前是8和17,后面我改成了14和17.

<uses-sdk  
    android:minSdkVersion="14"
    android:targetSdkVersion="17"/>

(2)、build.gradle

defaultConfig {
        applicationId "com.data.project"
        minSdkVersion 14
        targetSdkVersion 17
    }
dependencies {
     //这行是编译时自动生成的
    compile 'com.google.android.gms:play-services-appindexing:8.1.0'

方法二

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    //重点1
    xmlns:tools="http://schemas.android.com/tools"
    package="com.data.project">

    <uses-sdk
        //重点2
        tools:node="replace" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

方法三

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    //重点1
    xmlns:tools="http://schemas.android.com/tools"
    package="com.data.project">

    <uses-sdk
        //重点2
       <uses-sdk tools:overrideLibrary="com.google.android.gms" /> />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

方法一解决了我的问题,这几个方法解决不了,混合起来试试,希望有用吧

  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值