自从将Android Studio更新到1.4版以来,作为我项目的依赖项的baseGameUtils无法构建。我猜想这与新的主题编辑器有关,因为当打开有错误的文件时,会弹出一个“有用的”弹出窗口,提示不应手动编辑这些生成的文件,而应该使用主题编辑器。 baseGameUtils没有可绘制的资源,主题或样式,因此我不知道为什么这个问题甚至存在?
Gradle Build finished with 102 error(s)
:baseGameUtils:generateDebugResValues UP-TO-DATE
:baseGameUtils:generateDebugResources
:baseGameUtils:mergeDebugResources
:baseGameUtils:processDebugManifest UP-TO-DATE
:baseGameUtils:processDebugResources
D:\Android_Studio_Projects\SuperAwesomeProject\baseGameUtils\build\intermediates\exploded-aar\com.android.support\appcompat-v7\22.2.0\res\values-v21\values-v21.xml
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
......
编辑。在遵循注释(AppCompat v7 r21 returning error in values.xml?)中链接的URL中的建议后,将注释改为针对SDK 21(为什么,为什么,为什么!!!)和Build Tools 21.0.2,GameHelper.Java不再编译,抱怨:
D:\Android_Studio_Projects\SuperAwesomeProject\baseGameUtils\src\main\java\com\google\example\games\basegameutils\GameHelper.java
Error:(32, 39) error: package com.google.android.gms.appstate does not exist
Error:(293, 28) error: cannot find symbol variable AppStateManager
Error:(294, 30) error: cannot find symbol variable AppStateManager
最佳答案
今天(2015年10月13日)有效的解决方案:
将baseGameUtils中的build.gradle更改为:
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.0.0'
compile 'com.google.android.gms:play-services:+'
}
用找到的最新here替换GameHelper.java。
用找到的最新here替换BaseGameActivity.java。
谢谢Google另一个浪费的早晨...
关于android - 构建baseGameUtils时,Android Studio 1.4 gradle失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33094886/