android - permission.ACCESS_MOCK_LOCATION 红线.. or Manifest merge failed with multiple errors

标签 android android-studio

我是初学者,我使用 Android Studio。一个问题一直困扰着我。

一直显示错误信息

Element uses-permission#com.google.android.providers.gsf.permission.READ_GSERVICES at AndroidManifest.xml:46:2-95 duplicated with element declared at AndroidManifest.xml:35:5-98

Element uses-permission#android.permission.ACCESS_COARSE_LOCATION at AndroidManifest.xml:47:2-78 duplicated with element declared at AndroidManifest.xml:22:5-81

Element uses-permission#android.permission.ACCESS_FINE_LOCATION at AndroidManifest.xml:48:2-76 duplicated with element declared at AndroidManifest.xml:23:5-79

tools:replace specified at line:67 for attribute tools:value, but no new value specified

Element meta-data#com.google.android.gms.version at AndroidManifest.xml:85:9-87:39 duplicated with element declared at AndroidManifest.xml:81:10-83:69

Validation failed, exiting

Manifest merger failed with multiple errors

还有红线

uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"

Mock locations should only be requested in a test or debug-specific manifest file (typically src/debug/AndroidManifest.xml) less... (Ctrl+F1) 
Using a mock location provider (by requiring the permission android.permission.ACCESS_MOCK_LOCATION) should only be done in debug builds (or from tests). In Gradle projects, that means you should only request this permission in a test or debug source set specific manifest file.  To fix this, create a new manifest file in the debug folder and move the <uses-permission> element there. A typical path to a debug manifest override file in a Gradle project is src/debug/AndroidManifest.xml.

我试过:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.Hi.Hello">



<application
        android:name="com.Hi.Hello.app.App"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:hardwareAccelerated="true"
        android:theme="@style/AppBaseTheme"
        tools:replace="value,icon,label,theme">

但我无法解决。权限问题和 list 合并失败,出现多个有关帮助的错误!!

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.Hi.Hello"
        minSdkVersion 14
        targetSdkVersion 23
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':bFAB')
    compile project(':bPhotoView')
    compile project(':bSlidingLayer')
    compile project(':bSlidingMenu')
    compile project(':bUniversalImageLoader')
    compile project(':bUtils')
    compile project(':bTwoWayView')
    compile project(':facebookSDK')
    compile project(':kakaoSDK')
    compile files('libs/httpclient-4.2.3.jar')
    compile files('libs/httpclient-cache-4.2.3.jar')
    compile files('libs/httpcore-4.2.2.jar')
    compile files('libs/httpmime-4.2.3.jar')
    compile files('libs/jsoup-1.7.3.jar')
    compile files('libs/gcm.jar')
    compile 'com.google.android.gms:play-services:8.1.0'
    compile 'com.google.code.gson:gson:2.2.2'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.google.android.gms:play-services-ads:8.1.0'
    compile 'com.google.android.gms:play-services-identity:8.1.0'
    compile 'com.google.gcm:gcm-server:1.0.0'
}

enter image description here

enter image description here

最佳答案

我认为问题就像错误消息描述的那样:

tools:replace specified at line:67 for attribute tools:value, but no new value specified

在您的应用程序标签中,您没有为“值”标签设置替换属性:

<application
    android:name="com.Hi.Hello.app.App"
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:hardwareAccelerated="true"
    android:theme="@style/AppBaseTheme"
    tools:replace="value,icon,label,theme">

因为我不知道应用程序标签中的“android:value”标签,我建议更改 tools:replace-node:

    tools:replace="icon,label,theme"

有关 list 合并的更多信息可在此处找到: http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger

关于android - permission.ACCESS_MOCK_LOCATION 红线.. or Manifest merge failed with multiple errors,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33493172/

相关文章:

java - 安卓.view.InflateException : Binary XML file line #13: Error inflating class ViewPager

android - java.lang.NoClassDefFoundError : com. amazonaws.mobileconnectors.apigateway.ApiResponse

android - Android Studio 中的错误检测

安卓工作室 : Signing issue after upgrade

android - Gradle构建在 “Configure Build”上失败

Android - 多行线性布局

android - 如何在扩展 BroadcastReceiver 的类中注册广播接收器?

android - Jetpack 中是否有类似颤动的热重载?

android - 如何使用android在图表引擎中实现TimeChart

android - 在 android studio 中添加没有菜单或操作栏的新 Activity ?