添加 Google 播放服务依赖项导致 "Error retrieving parent for item"
Adding Google Play-services dependency causes "Error retrieving parent for item"
在模拟器中启动我的应用程序时,我总是 运行 出错:
Error:(3) Error retrieving parent for item: No resource found that matches
the given name
'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
Error:(4) Error retrieving parent for item: No resource found that matches
the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
Error:(3) Error retrieving parent for item: No resource found that matches
the given name
'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
Error:(4) Error retrieving parent for item: No resource found that matches
the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
我用的是API23,看到过类似的帖子说SDK版本需要匹配支持库。
但是,我所做的只是创建项目,然后添加 Google-play 服务依赖项,然后尝试 运行 我的应用程序,我得到了这些错误。
下面是我的build.grade文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "jamiefuller.myapplication"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:11.0.4'
}
您无法使用 api 23 进行编译,因为您正在使用编译 'com.google.android.gms:play-services:11.0.4'
(它依赖于支持库)。
使用:
compileSdkVersion 26
在模拟器中启动我的应用程序时,我总是 运行 出错:
Error:(3) Error retrieving parent for item: No resource found that matches
the given name
'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
Error:(4) Error retrieving parent for item: No resource found that matches
the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
Error:(3) Error retrieving parent for item: No resource found that matches
the given name
'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
Error:(4) Error retrieving parent for item: No resource found that matches
the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
我用的是API23,看到过类似的帖子说SDK版本需要匹配支持库。
但是,我所做的只是创建项目,然后添加 Google-play 服务依赖项,然后尝试 运行 我的应用程序,我得到了这些错误。
下面是我的build.grade文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "jamiefuller.myapplication"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:11.0.4'
}
您无法使用 api 23 进行编译,因为您正在使用编译 'com.google.android.gms:play-services:11.0.4'
(它依赖于支持库)。
使用:
compileSdkVersion 26