【问题标题】:R file, styles.xml and android.graphics.TypefaceR 文件、styles.xml 和 android.graphics.Typeface
【发布时间】:2014-09-27 02:51:37
【问题描述】:

我在 linux 中安装了 Luna,并从 juno/kepler 导入了我的项目(现在不确定),我收到以下错误

我的 R 文件消失了,我认为这是由于 xml 解析错误造成的。

每当打开与布局相关的任何 *.xml 时,我都会收到此消息:

parseSdkContent failed Could not initialize class android.graphics.Typeface x 2(出现多个错误)

作为建议的答案,我在 /home 中删除了 .android,但错误仍然存​​在。

我在我的项目中运行 Android 2.2(我可以看到包含该库)虽然 Right Click -> Project Properties -> Android -> Has Android 2.2, Android 4.4W and Android L (Preview) ALL 未选中并且“应用”按钮没有当我关闭窗口时工作(选择 android 2.2)。

每当我打开 Android SDK Manager 时都会收到此消息

parseSdkContent failed Could not initialize class android.graphics.Typeface

在我的 styles.xml 文件中出现以下错误:

error => <style name="AppBaseTheme" parent="android:Theme.Holo.Light"> <!-- API 11 theme customizations can go here. --> </style>

error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'.

error => <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <!-- API 14 theme customizations can go here. --> </style>

error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar'.

我在 android sdk 管理器 中检查了更新,但没有发现,已安装:

  • 工具
  • Android SDK 工具
  • Android SDK 平台工具
  • Android SDK 构建工具
  • ANDROID L API 20,L 预览版
  • SDK 平台 Android L 预览版
  • Android TV ARM EABI v7a 系统映像
  • Android TV Intel x86 Atom 系统映像
  • ANDROID 4.4W API 20
  • SDK 平台
  • Android Wear ARM EABI v7a 系统映像
  • Android Wear Intel x86 Atom 系统映像
  • ANDROID 2.2 API 8
  • SDK 平台
  • Android 支持库

这是我的 AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.diverse.just"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="20" />

    <uses-permission android:name="android.permission.INTERNET"></uses-permission>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.diverse.just.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>
        <activity
            android:name="com.diverse.just.LoginActivity"
            android:label="@string/title_activity_login"
            android:windowSoftInputMode="adjustResize|stateVisible" >
        </activity>
    </application>

【问题讨论】:

    标签: android xml eclipse


    【解决方案1】:

    如果res文件夹有任何错误R文件不会生成。 styles 文件夹中有错误,因为 android:Theme.Holo.Lightandroid:Theme.Holo.Light.DarkActionBar 不适用于 api-8(android 2.2)

    1. 右键单击您的项目。
    2. 转到属性。
    3. 从左侧面板中选择Android 选项。
    4. 检查任何安卓platform 3.0 or above
    5. 清理您的项目。

    编辑:

    【讨论】:

    • 那么我如何检查 2.2 的实际可用主题(默认)?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-01
    • 1970-01-01
    • 2013-02-16
    • 2017-09-19
    • 2017-11-27
    • 1970-01-01
    • 2015-02-06
    相关资源
    最近更新 更多