Android Manifest合并失败的SmartLocation库

时间:2016-08-27 08:51:50

标签: android location android-manifest build.gradle

我正在尝试将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"
}

main / 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)找不到属性的资源标识符&#39;替换&#39;在   package&#39; project.com.selfieoffice&#39;错误:(28)没有资源标识符   找到属性&#39;替换&#39;在包&#39; project.com.selfieoffice&#39;   错误:任务&#39;:app:processDebugResources&#39;执行失败。

     
    

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:Process&#39;命令     &#39; /Users/zulqurnainjutt/Library/Android/sdk/build-tools/23.0.0/aapt'&#39;     完成非零退出值1

  

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

如果我做了某些事情,它会在库页面Problems部分中提供android清单合并的消息,是否有人使用此lib可以提供帮助?

1 个答案:

答案 0 :(得分:0)

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

  • 从我的Android清单的所有位置删除tools:replace代码,调试并主要

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

  • 在主要Android清单中的标记上方添加/替换<meta-data tools:replace="android:value" android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

  • 检查您是否已经有Google Play服务,如果没有,请执行此操作=&gt;右键单击app包点击open module settings转到dependency标签,点击+,然后选择com.google.android.gms:play-services:xxxx,然后确定。

  • 清理并重建享受