在gradle中添加play服务依赖项会导致Android Studio中的许多错误

时间:2021-11-05 04:53:45

I'm tying to add play services dependency along with FireBase in build.gradle. But it throws some 100+ errors.

我打算在build.gradle中添加play服务依赖项和FireBase。但它会抛出100多个错误。

Here's my project's build.gradle :

这是我的项目的构建。gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0'
        classpath 'com.google.gms:google-services:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Module build.gradle (app/build.gradle):

模块构建。gradle(app / build.gradle):

apply plugin: 'com.android.application'
android {
    compileSdkVersion 20
    buildToolsVersion "23.0.3"
    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')
        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
    lintOptions {
        abortOnError false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    productFlavors {
        x86 {
            ndk {
                abiFilter "x86"
            }
        }
        arm {
            ndk {
                abiFilters "armeabi-v7a", "armeabi"
            }
            minSdkVersion 17
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/notice.txt'
    }
    defaultConfig {
        applicationId "com.example.exampleapp"
        minSdkVersion 17
    }



}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.google.firebase:firebase-messaging:9.6.1'
    compile 'com.google.android.gms:play-services:9.6.1'
}
apply plugin: 'com.google.gms.google-services'

Here's the logcat :

这是logcat:

D:\Workspaces\Android\newestPES\exampleapp\app\build\intermediates\res\merged\arm\debug\values-ldltr-v21\values-ldltr-v21.xml
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.
D:\Workspaces\Android\newestPES\att-helpme-android\app\build\intermediates\res\merged\arm\debug\values-v21\values-v21.xml
Error:(13) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(15) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:(21) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:(28) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:(212) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
Error:(214) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:(222) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'.
Error:(232) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.
Error:(254) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar'.
Error:(172) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:(185) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.EditText'.
Error:(6) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:(5) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:(7) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:(8) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:(9) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:(10) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.
Error:(11) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.
Error:(12) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:(14) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.
Error:(16) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(18) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(20) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'.
Error:(22) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'.
Error:(23) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'.
Error:(25) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Title'.
Error:(27) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'.
Error:(29) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'.
Error:(30) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'.
Error:(31) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(33) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'.
Error:(35) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(37) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'.
Error:(39) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.
Error:(41) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.
Error:(43) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button'.
Error:(49) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(51) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(53) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(54) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.TextView.SpinnerItem'.
Error:(55) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(57) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(161) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'.
Error:(163) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'.
Error:(165) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
Error:(167) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'.
Error:(170) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'.
Error:(175) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button'.
Error:(176) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless'.
Error:(177) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless.Colored'.
Error:(180) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Small'.
Error:(181) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ButtonBar'.
Error:(182) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.CheckBox'.
Error:(183) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.RadioButton'.
Error:(184) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'.
Error:(188) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ImageButton'.
Error:(189) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:(191) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:(193) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'.
Error:(195) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'.
Error:(201) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'.
Error:(203) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'.
Error:(204) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'.
Error:(206) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'.
Error:(216) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.RatingBar'.
Error:(217) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.SeekBar'.
Error:(218) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:(219) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.TextView.SpinnerItem'.
Error:(220) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'.
D:\Workspaces\Android\newestPES\att-helpme-android\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\24.0.0\res\values-v21\values-v21.xml
Error:(64, 5) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(64, 5) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(64, 5) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(64, 5) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(64, 5) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(64, 5) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(64, 5) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(108, 5) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(111, 5) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(111, 5) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(111, 5) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(111, 5) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(111, 5) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(111, 5) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(111, 5) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(155, 5) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(158, 5) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(197, 5) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:(208, 5) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:(242, 5) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(242, 5) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(242, 5) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(242, 5) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(242, 5) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(242, 5) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(242, 5) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
D:\Workspaces\Android\newestPES\att-helpme-android\app\build\intermediates\res\merged\arm\debug\values-v23\values-v23.xml
Error:(37) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.
Error:(33) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless.Colored'.
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Menu'.
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Error:(35) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.RatingBar.Indicator'.
Error:(36) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.RatingBar.Small'.
Error:Execution failed for task ':app:processArmDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\Android\sdk\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1

1 个解决方案

#1


1  

Since you are using the 9.6.1 you have to compile with api 24.

因为您使用的是9.6.1,所以必须使用api 24进行编译。

Change the

改变

  compileSdkVersion 20

to

  compileSdkVersion 24

#1


1  

Since you are using the 9.6.1 you have to compile with api 24.

因为您使用的是9.6.1,所以必须使用api 24进行编译。

Change the

改变

  compileSdkVersion 20

to

  compileSdkVersion 24