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

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

问题描述

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

我导航到说没有找到样式attr的行,并选择查找用法,但它表示没有在这个项目中的使用。我也尝试删除Twitter工具包并重新加载,并加载较旧的版本,两者仍然存在此问题。如何解决这个问题?



该项目从一开始就是用android studio 3.0 canary构建的。这是应用gradle文件:

  apply plugin:'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion26.0.1
defaultConfig {
applicationId...
minSdkVersion 19
targetSdkVersion 26
versionCode 3
versionNamebeta1
testInstrumentationRunnerandroid.support.test.runner.AndroidJUnitRunner
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}

依赖关系{
编译fileTree(包括:['* .jar'],dir:'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2 .2',{
排除组:'com.android.support',模块:'suppor t-annotations'
})

testCompile'junit:junit:4.12'
compile'c​​om.android.support.constraint:constraint-layout:1.0.2'
编译'com.android.support:support-v4:26.0.0'
编译'com.android.support:recyclerview-v7:26.0.0'
编译'com.twitter.sdk。 android:twitter:3.1.0'
compile'c​​om.jakewharton:butterknife:8.7.0'
compile'c​​om.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'h ttps://maven.google.com'}
}
依赖关系{
classpath'com.android.tools.build:gradle:3.0.0-alpha9'

//注意:不要在这里放置您的应用程序依赖项;它们属于单个模块build.gradle文件中的
//
}
}

allprojects {
存储库{
jcenter()
maven {url'https://maven.google.com'}
}
}

任务清理(类型:删除){
删除rootProject .buildDir
}


解决方案

与主题和风格。可能你的一个图书馆期待着这种风格可用,而且它没有找到它。请参阅无法正确设置Android Actionbar背景作为指导如何填写这个特殊的属性可能适合你。



这个资源似乎已经在2013年根据谷歌的差异在这里推出 https://android.googlesource.com/platform/tools/base/+/f5215ae4712f468568b58c20baadd14b769c10c4%5E!/



更改您的themes.xml,然后在清单中使用它或更改styles.xml,如果处理不当,可能会导致这些副作用。 b $ b

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:

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?

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'
}

And another build file:

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
}

解决方案

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.

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

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天全站免登陆