找不到 Gradle 构建错误样式属性 [英] Gradle build error style attributes not found

查看:22
本文介绍了找不到 Gradle 构建错误样式属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过从 GitHub 中检出 git 来将我的项目回滚到以前的版本,但我认为我以错误的方式做这件事.我刚刚删除了本地项目并在android studio上查看了git地址.但是,gradle 无法构建并显示此消息:

I was trying to roll my project back to a previous version by checking the git out from GitHub, but I think I did it in a wrong way. I just removed the local project and checked out the git address on android studio. However, the gradle can't build and shows this message:

我导航到没有找到样式属性的那一行,然后选择查找用法,但它说在这个项目中没有用法.我还尝试删除了 twitter 工具包并再次加载它,并加载了旧版本,两者仍然存在此问题.如何解决这个问题?

I navigate to the line that is saying style attr not found, and select find usage, but it says no usage in this project. I also tried removed the twitter tool kits and load it again, and load an older verision, both still have this issue. How to fix this?

该项目从一开始就使用 android studio 3.0 canary 构建.这是应用程序 gradle 文件:

The project is build with android studio 3.0 canary from beginning. this is the app gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "..."
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 3
        versionName "beta1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    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'
    })

    testCompile 'junit:junit:4.12'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:26.0.0'
    compile 'com.android.support:recyclerview-v7:26.0.0'
    compile 'com.twitter.sdk.android:twitter:3.1.0'
    compile 'com.jakewharton:butterknife:8.7.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.8.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    annotationProcessor 'com.github.bumptech.glide:glide:3.7.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
    implementation 'com.android.support:appcompat-v7:26.0.0'
    implementation 'com.android.support:design:26.0.0'
}

还有另一个构建文件:

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-alpha9'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
    }
}

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

推荐答案

那是主题和样式的问题.可能您的某个库希望该样式可用,但没有找到.请参阅此处无法正确设置 Android 操作栏背景作为如何填写的指南可能对您有用的特定属性.

That is a problem with themes and styles. Probably one of your libraries is expecting that style to be available and it's not finding it. See here Cant set Android Actionbar Background correctly as a guide on how to fill in that particular attribute that may work for you.

根据谷歌在此处的差异,该资源似乎是在 2013 年引入的 https://android.googlesource.com/platform/tools/base/+/f5215ae4712f468568b58c20baadd14b769c10c4%5E!/

This resource seems to have been introduced in 2013 according to google's diffs here https://android.googlesource.com/platform/tools/base/+/f5215ae4712f468568b58c20baadd14b769c10c4%5E!/

更改您的 themes.xml 然后从清单中使用它,或者更改 style.xml 如果操作不当可能会导致这些副作用.

Changing your themes.xml followed by using it from the manifest, or changing styles.xml can potentially cause those side effects if not done properly.

这篇关于找不到 Gradle 构建错误样式属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆