0

我目前正在嘗試使用Android L SDK版本創建一個Android應用程序。 然而,試圖建立使用搖籃我的項目的時候,我遇到了以下錯誤:無法讓Gradle構建Android L「錯誤:找到項目樣式/ AppTheme不止一次」

「錯誤:找到了項樣式/ AppTheme超過一次」

指向我RES /值 - v21/styles.xml

我知道在res/values/styles.xml中有一個已經定義的樣式「AppTheme」,但據我所知我遵循Android開發者指南使用Android L.也許有人可以幫助我:

這是我的:

的build.gradle

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 'android-L' 
    buildToolsVersion '20.0.0' 

defaultConfig { 
    applicationId "com.mayuonline.ribbit" 
    minSdkVersion 'L' 
    targetSdkVersion 'L' 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     runProguard false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:support-v4:20.+' 
} 

的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="resume.kelseyhrubes" > 

    <uses-sdk android:minSdkVersion="L" android:targetSdkVersion="L"/> 
    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name=".MainActivity" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 

值/ styles.xml

<resources> 
    <!-- inherit from the material theme --> 
     <style name="AppTheme" parent="android:Theme.Material"> 
    <!-- Main theme colors --> 
    <!-- your app branding color for the app bar --> 
      <item name="android:colorPrimary">@color/primary</item> 
    <!-- darker variant for the status bar and contextual app bars --> 
      <item name="android:colorPrimaryDark">@color/primary_dark</item> 
    <!-- theme UI controls like checkboxes and text fields --> 
      <item name="android:colorAccent">@color/primary_light</item> 
    </style> 
</resources> 

值-V21/styles.xml

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="AppTheme" parent="android:Theme.Material.Light"> 
    </style> 

    <style name="AppTheme">@color/primary 

     @color/primary_dark 

     @color/primary_light 
    </style> 
</resources> 

我的壞格式道歉,我希望一切是可讀的。 如果有人知道我做錯了什麼,請告訴我。我只是想用這種甜蜜的材料設計製作應用程序。

+0

像錯誤狀態預覽SDK,你AppTheme價值觀-V21/styles.xml定義了兩次。刪除其中一個。 – alanv 2014-10-30 00:06:27

+0

當然啊!我不確定爲什麼我沒有注意到這一點。 – Kelsey 2014-10-31 10:40:45

回答

0

你不應該使用L了,這是你需要使用21使用官方SDK

相關問題