2016-11-23 98 views
1

目前,我的styles.xml文件顯示不正確。 Theme.AppCompat.Light.NoActionBar無法解析。我已經重新啓動android studio,但它仍然無法工作。我試過無效緩存/重啓,但它不起作用。它不會讓我的應用程序崩潰,但它爲什麼會發生。看看下面的圖片:我的風格有什麼問題?無法解析符號Theme.AppCompat.Light.NoActionBar

.

這是我的build.gradle文件

import org.apache.tools.ant.taskdefs.condition.Os 

apply plugin: 'com.android.application' 
apply plugin: 'com.google.gms.google-services' 

android { 
    compileSdkVersion 23 
    buildToolsVersion '25.0.0' 

    defaultConfig { 
     applicationId "xx.com.xxx.xxxx" 
     minSdkVersion 17 
     targetSdkVersion 23 
     versionCode 21 
     versionName "1.2.0" 
     renderscriptTargetApi 23 
     renderscriptSupportModeEnabled true 

     // Enabling multidex support. 
     multiDexEnabled true 
    } 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile('com.afollestad.material-dialogs:core:[email protected]') { 
     transitive = true 
    } 
    compile('com.mikepenz:actionitembadge:[email protected]') { 
     transitive = true 
    } 
    compile project(':blurringview') 
    compile 'com.android.support:support-v4:23.3.0' 
    compile 'com.android.support:appcompat-v7:23.3.0' 
    compile 'com.android.support:design:23.3.0' 
    compile 'com.android.support:cardview-v7:23.3.0' 
    compile 'com.android.support:recyclerview-v7:23.3.0' 
    compile 'com.google.android.gms:play-services-gcm:8.3.0' 
    compile 'com.android.support:palette-v7:23.3.0' 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.wdullaer:materialdatetimepicker:1.5.1' 
    compile 'com.pnikosis:materialish-progress:1.5' 
    compile 'com.mikepenz:iconics:[email protected]' 
    compile 'com.mikepenz.iconics:community-material-typeface:[email protected]' 
    compile 'com.soundcloud.android:android-crop:[email protected]' 
    compile 'org.apache.commons:commons-lang3:3.4' 
    ... 
} 

... 
} 
+0

你可以在這裏顯示你的build.gradle文件。 – Soham

+0

我假設你忘了在build.gradle中加入:compile'c​​om.android.support:appcompat-v7:XX.XX.XX'。觀看版本信息:https://developer.android.com/topic/libraries/support-library/features.html#v7-appcompat – David

+0

沒有@大衛。我擁有它。在我的build.gradle文件中是'compile'c​​om.android.support:appcompat-v7:23.3.0'' –

回答

6

最後,這裏是我的第一個解決方案。發生錯誤是因爲gradle不適用於版本較低的庫。它不編譯外部庫appcompat-v7:23.3.0。我現在所做的是將gradle plugin frorm 2. +降級到2.2.0和重建項目。它現在再次運作。

此鏈接顯示如何降級版本gradle [Link]

這不是一個好主意,思想,但它確實救了我的問題。

任何其他想法或意見,以改善,歡迎。

+1

謝謝,這有助於解決我的問題。基本上,當Android Studio試圖強制你升級它時,你應該永遠不要接受gradle升級,並且你會有少量的谷歌問題。恥辱他們在編程上如此糟糕,不再測試任何東西。我從來沒有真正的gradle升級不引入錯誤 – behelit