请修改版本冲突,方法是更新google-services插件的版本或将com.google.android.gms更新为9.4.0

时间:2017-03-10 07:12:08

标签: android

我收到此错误

错误:任务':app:processDebugGoogleServices'执行失败。

  

请通过更新google-services插件的版本(https://bintray.com/android/android-tools/com.google.gms.google-services/提供有关最新版本的信息)或将com.google.android.gms的版本更新为9.4.0来修复版本冲突

我不知道出了什么问题。我也包含了这个插件 申请插件:'com.google.gms.google-services'

我仍然无法摆脱它。

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "24.0.2"

defaultConfig {
    applicationId "com.example.raghav.AurinkoInfotech"
    minSdkVersion 21
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.google.android.gms:play-services-ads:10.2.0'
compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.google.android.gms:play-services-gcm:10.2.0'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
}

apply plugin: 'com.google.gms.google-services'

如果我将其设为9.4.0,那么它会给我以下错误

Error:(16) No resource identifier found for attribute 'itemTextColor' in package 'com.example.raghav.AurinkoInfotech'

Error:(16) No resource identifier found for attribute 'headerLayout' in package 'com.example.raghav.AurinkoInfotech'

Error:(16) No resource identifier found for attribute 'menu' in package 'com.example.raghav.AurinkoInfotech'

以下是我的依赖项:

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
}

apply plugin: 'com.google.gms.google-services'

现在错误如下:

Error:(16) No resource identifier found for attribute 'itemTextColor' in package 'com.example.raghav.AurinkoInfotech'

Error:(16) No resource identifier found for attribute 'headerLayout' in package 'com.example.raghav.AurinkoInfotech'

Error:(16) No resource identifier found for attribute 'menu' in package 'com.example.raghav.AurinkoInfotech'

Error:(3) No resource identifier found for attribute 'layout_behavior' in package 'com.example.raghav.AurinkoInfotech'

Error:(10, 26) No resource found that matches the given name (at 'layout_behavior' with value '@string/appbar_scrolling_view_behavior').

Error:(3) No resource identifier found for attribute 'layout_behavior' in package 'com.example.raghav.AurinkoInfotech'

Error:(10, 26) No resource found that matches the given name (at 'layout_behavior' with value '@string/appbar_scrolling_view_behavior').

Error:(18) No resource identifier found for attribute 'headerLayout' in package 'com.example.raghav.AurinkoInfotech'

Error:(18) No resource identifier found for attribute 'menu' in package 'com.example.raghav.AurinkoInfotech'

Error:Execution failed for task ':app:processDebugResources'.
  

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:处理'命令'C:\ Users \ Raghav \ AppData \ Local \ Android \ Sdk \ build-tools \ 24.0。 2 \ aapt.exe''以非零退出值1结束

查看我的布局文件,看看你是否找到了什么

 <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

    <include
        layout="@layout/app_bar_dashboard"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        android:background="#04867c"
        app:itemTextColor="#fff"
        app:headerLayout="@layout/nav_header_dashboard"
        app:menu="@menu/activity_dashboard_drawer"/>

    </android.support.v4.widget.DrawerLayout>

2 个答案:

答案 0 :(得分:1)

所有Google服务必须是同一版本

compile 'com.google.android.gms:play-services-ads:10.2.0'
compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.google.android.gms:play-services-gcm:10.2.0'
compile 'com.google.android.gms:play-services:10.2.0'

并设置

compile 'com.google.firebase:firebase-messaging:9.4.0' -> 10.2.0

答案 1 :(得分:1)

首先,

将您的firebase-messaging版本更改为10.2.0

还有一件事是你为项目的gradle添加了classpath 'com.google.gms:google-services:3.0.0'吗?如果不是 - 也在你dependencies中添加一个。

解决No resource found错误,您忘记添加设计库
app.gradle

中添加此行

compile 'com.android.support:design:25.2.0'