【问题标题】:Android Manifest merging failed SmartLocation libraryAndroid Manifest 合并失败的 SmartLocation 库
【发布时间】:2016-08-27 08:51:49
【问题描述】:

我试图在我的项目中包含 SmartLocation github library 并得到如此令人困惑的错误。

build.grade(app):

apply plugin: 'com.android.application'
apply plugin: 'android-apt'
def AAVersion = '4.0.0' 
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    defaultConfig {
        applicationId "project.com.selfieoffice"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile ('io.nlopez.smartlocation:library:3.2.5') {
        transitive = false
    }
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
}

主/AndroidManifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/apk/res-auto"
    package="project.com.selfieoffice">
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        tools:replace="android:value"
        android:screenOrientation="landscape"
        android:theme="@style/AppTheme">
        <meta-data
            tools:replace="android:value"
            android:name="com.google.android.gms.version" />
        <activity android:name=".activities.MainActivity_">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

调试/AndroidManifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/apk/res-auto"
    package="project.com.selfieoffice"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="23" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:screenOrientation="landscape"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:replace="android:value" >
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="6587000"
            tools:replace="android:value" />
        <activity android:name="project.com.selfieoffice.activities.MainActivity_" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <service
            android:name="io.nlopez.smartlocation.activity.providers.ActivityGooglePlayServicesProvider$ActivityRecognitionService"
            android:exported="false" />
        <service
            android:name="io.nlopez.smartlocation.geofencing.providers.GeofencingGooglePlayServicesProvider$GeofencingService"
            android:exported="false" />
        <service
            android:name="io.nlopez.smartlocation.geocoding.providers.AndroidGeocodingProvider$AndroidGeocodingService"
            android:exported="false" />
    </application>
</manifest>

错误:

/Users/zulqurnainjutt/Desktop/AndroidProjects/SelfieOffice/app/build/intermediates/manifests/full/debug/AndroidManifest.xml 错误:(20)没有找到属性“替换”的资源标识符 包'project.com.selfieoffice'错误:(28)没有资源标识符 在包“project.com.selfieoffice”中找到属性“替换” 错误:任务 ':app:processDebugResources' 执行失败。

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/zulqurnainjutt/Library/Android/sdk/build-tools/23.0.0/aapt'' 以非零退出值 1 结束

这个项目有什么问题?为什么我不能包含智能位置库。

如果我做某事,它会给出 android manifest 合并的消息,如库页面 Problems 部分中所述,使用此库的任何人都可以提供帮助吗?

【问题讨论】:

  • 我已将tools:replace="android:value" 放置在我可以使其工作的每个可能的地方,例如在 标签中,在 标签中,将其从其中一个中删除,检查每个组合,否成功
  • 有什么要我做的吗?
  • 问题是什么是正确的地方

标签: android location android-manifest build.gradle


【解决方案1】:

感谢@Dipali shah,我刚刚通过以下步骤解决了我的问题:

  • 从我的 Android manifests、debug 和 main 的所有地方删除 tools:replace 标签

  • 将我的xmlns:tools="http://schemas.android.com/apk/res-auto" 替换为xmlns:tools="http://schemas.android.com/tools"

  • 在主 Android 清单中的标签上方的标签中添加/替换 &lt;meta-data tools:replace="android:value" android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt;

  • 检查您是否已经有 google play 服务,如果没有,请执行此操作 => 右键单击​​ app 包单击 open module settings 转到 dependency 选项卡,单击 + 并选择 com.google.android.gms:play-services:xxxx 并好的。

  • 清洁和重建享受

【讨论】:

    猜你喜欢
    • 2015-09-12
    • 2017-03-13
    • 2020-01-03
    • 2017-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-01
    相关资源
    最近更新 更多