簡體   English   中英

android:找不到資源(清單錯誤)

[英]android: no resource found ( manifest error)

每當編譯應用程序時,都會出現此錯誤。此問題僅在此應用程序中。 我已經開發了其他應用程序,並且它們沒有問題,但是每當我編譯該項目時,此錯誤就會開始出現。

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文件是這個 圖片

在您的資源文件夾下的下檢查樣式文件夾。

如果不添加此代碼,則存在此代碼...並使用AppCompatActivity。

如果存在,請檢查清單文件並在應用程序級別添加主題

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

好吧試試看

在Android Studio中轉到“ 構建” >“ 重建項目”

轉到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>

現在清理並重建您的項目,問題將得到解決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM