2016-11-23 49 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