[英]Cannot use android:Theme.AppCompat.Light
I've ready pretty much every question on here, answered or no, and followed all of the steps, to no avail. 我已经准备好了几乎每个问题,回答或没有,并遵循所有步骤,无济于事。 I am using Eclipse to use Google App Engine.
我正在使用Eclipse来使用Google App Engine。 This is what I've done:
这就是我所做的:
-Added android-support-v4.jar to my libs folder -Added android-support-v7-appcompat.jar to my libs folder -Right click project >> Properties >> Libraries tab; -Added android-support-v4.jar到我的libs文件夹-Added android-support-v7-appcompat.jar到我的libs文件夹-Right click project >> Properties >> Libraries选项卡; Click "Add JARs..." >> browse to libs folder and select those two JARs -Select "Order and Export" tab;
单击“添加JAR ...”>>浏览到libs文件夹并选择这两个JAR - 选择“订单和导出”选项卡; checked both of those JARs;
检查了这两个JAR; unchecked "Android Dependencies";
未经检查的“Android Dependencies”; Click "OK"
点击“确定”
This is my styles.xml file: 这是我的styles.xml文件:
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
This is my AndroidManifest.xml: 这是我的AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.appengine"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<permission
android:name="com.appengine.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.appengine.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<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>
<service android:name=".GCMIntentService" />
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.appengine" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.appengine" />
</intent-filter>
</receiver>
<activity
android:name=".RegisterActivity"
android:launchMode="singleTop" />
<activity
android:name=".SendData"
android:launchMode="singleTop"
android:value="android.support.v7.app.ActionBarActivity" />
</application>
When I attempt to run the project (USB connected Galaxy S4, currently running 4.4.2) I get: 当我尝试运行项目(USB连接Galaxy S4,当前运行4.4.2)时,我得到:
G:\workspace\appengine\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.AppCompat.Light'.
I've been fighting this for a few days now, can anyone save me from giving up the life of a developer? 我已经打了几天了,有人可以免除我放弃开发人员的生活吗?
I have never referenced any theme with android
namespace. 我从来没有用
android
命名空间引用任何主题。
Usually it's 通常是
<style name="AppTheme" parent="@style/Theme.AppCompat.Light">
or just: 要不就:
<style name="AppTheme" parent="Theme.AppCompat.Light">
you can't just add the v7 jar to your libs folder. 你不能只是将v7 jar添加到libs文件夹中。 you need to make a library project for v7 and link your project to that.
您需要为v7创建一个库项目并将项目链接到该项目。
read the section 'Adding libraries with resources' on https://developer.android.com/tools/support-library/setup.html 请阅读https://developer.android.com/tools/support-library/setup.html上的 “使用资源添加库”部分
PS, but the v4 jar can simply be dropped in the libs folder. PS,但v4 jar可以简单地放在libs文件夹中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.