2015-11-25 136 views
0

每当一个编译应用程序出现这个错误。这个问题只是在这个应用程序。我开发了其他的应用程序,并没有问题,但每当我编译这个项目时,这个错误就开始了。android:找不到资源(明显错误)

gradle file is this: 

    apply plugin: 'com.android.application' 

    android { 
    compileSdkVersion 22 
    buildToolsVersion "22.0.1" 

    defaultConfig { 
     applicationId "cme.ws.com.ws.cme" 
     minSdkVersion 8 
     targetSdkVersion 22 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'),  'proguard-rules.pro' 
      } 
      } 
     } 

    dependencies { 
     compile fileTree(dir: 'libs', include: ['*.jar']) 
     compile 'com.android.support:appcompat-v7:22.0.0' 
    } 


error portion is this: 
      android:theme="@style/AppTheme"> 

这些是错误。 gradle这个文件是这个 image

+0

有时这发生在Android工作室更新 –

+0

之后那么这个先生的解决方案是什么 –

+0

您是否尝试过完整的项目同步? – Altoyyr

回答

0

前往res/values/styles.xml

添加此代码。

<!-- Base application theme. --> 
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
</style> 

“colorPrimary”,“colorPrimaryDark”,“colorAccent”是您的应用颜色属性。在我来说,我在我的color.xml

<color name="colorPrimary">#1a2a3a</color> 
<color name="colorPrimaryDark">#0e1720</color> 
<color name="colorAccent">#1AB394</color> 

现在干净拥有这些价值观,重建项目时,问题就会得到解决。

0

检查风格下文件夹下你的资源文件夹。

存在此代码,如果不添加它...并使用AppCompatActivity。

如果存在检查清单文件,并在您的应用程序级别添加主题

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 

那么试试这个

转到建设>在android系统改造工程工作室

+0

哪个代码先生....? –