构建baseGameUtils

时间:2015-10-13 05:37:44

标签: android android-studio gradle resources

自从将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

1 个答案:

答案 0 :(得分:1)

今天似乎有效的解决方案(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:+'
}

将GameHelper.java替换为找到的最新版本here 将BaseGameActivity.java替换为找到的最新版本here

感谢Google另一个浪费的早晨...