2017-08-09 37 views
1

我試圖通過從GitHub中檢查git來將我的項目重新回到以前的版本,但我認爲我是以錯誤的方式完成的。我剛剛刪除了本地項目,並檢出了android studio上的git地址。但是,Gradle無法構建並顯示此消息:未找到Gradle構建錯誤樣式屬性

我導航到說找不到樣式attr的行,並選擇查找用法,但它說在此項目中沒有用法。我也嘗試刪除Twitter工具包並重新加載,並加載較舊的版本,兩者仍然存在此問題。如何解決這個問題? gradle build wrong

該項目是從android studio 3.0 canary開始構建的。這是應用程序文件的gradle:

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 
} 
+2

你可以試試'Build/Clean Project'然後'File/Invalidate Caches Restart'嗎?原因是如果存在合併/生成的XML和來自git的外部更新,那麼生成的XML可能引用了來自上游的類 –

+1

是的,在此回滾版本中,某些xml文件已消失,並且不會生成引用錯誤。我想我在合併時選擇了錯誤的基本分支。非常感謝!@DavidRawson – Robin

回答

1

即與主題和風格的問題。可能你的一個圖書館期待着這種風格可用,而且它沒有找到它。請參閱此處Cant set Android Actionbar Background correctly作爲如何填寫可能適合您的特定屬性的指南。

此資源似乎已經在2013年根據谷歌的差異列表這裏https://android.googlesource.com/platform/tools/base/+/f5215ae4712f468568b58c20baadd14b769c10c4%5E!/

更改您的themes.xml然後用它從清單,或改變styles.xml可能會導致這些副作用被引入,如果不這樣做正常。

+0

是的,這是一個主題問題。我有一個未使用的樣式引用了庫中的私有顏色屬性。刪除了風格,現在運行良好。非常感謝! – Robin

相關問題