I am currently trying to create an Android app using the Android L SDK version. However, when trying to build my project using Gradle, I run into the following error:
我目前正在尝试使用Android L SDK版本创建一个Android应用。但是,在尝试使用Gradle构建项目时,我遇到了以下错误:
"Error: Found item Style/AppTheme more than one time"
“错误:发现项目样式/AppTheme不止一次”
Which points to my res/values-v21/styles.xml
哪个指向我的res/values-v21/styles.xml
I know that in res/values/styles.xml there is a style "AppTheme" already defined, but as far as I know I was following the Android developers guide on using Android L. Perhaps someone can help me:
我知道在res/values/styles中。xml有一个已经定义的样式“AppTheme”,但据我所知,我一直在遵循Android开发人员使用Android的指南,也许有人可以帮助我:
Here is my:
这是我的:
build.gradle
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
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>
values/styles.xml
值/ 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>
values-v21/styles.xml
values-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>
I apologize for the bad formatting, I hope everything is readable. If anyone knows what I am doing wrong, please let me know. I just want to make an app with that sweet material design.
很抱歉格式不好,希望大家都能看懂。如果有人知道我做错了什么,请告诉我。我只是想做一个有甜美材料设计的应用。
1 个解决方案
#1
0
you should not be using L
anymore, that was the preview SDK you need to use 21
to use the official SDK
你不应该再使用L,那是你需要使用21才能使用官方SDK的预览SDK
#1
0
you should not be using L
anymore, that was the preview SDK you need to use 21
to use the official SDK
你不应该再使用L,那是你需要使用21才能使用官方SDK的预览SDK