【问题标题】:R.java missing but no xml errorsR.java 丢失但没有 xml 错误
【发布时间】:2012-12-20 05:36:15
【问题描述】:

我一直在尝试将我的活动转换为片段,在此过程中,我在某个文件中弄乱了一些东西。我收到了找不到我的 R.java 文件的错误,我检查了我的所有库,但它们的 xml 文件中没有错误。我的应用程序 xml 文件中也没有错误。嗯,可能有,但他们没有出现。

我已多次清理我的项目,并重新启动了 Eclipse,但似乎没有任何效果。我的 xml 文件中没有出现任何错误,所以你们都有解决这个问题的想法吗?

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.fotolife.app"
    android:versionCode="1"
    android:versionName="1" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <uses-feature android:name="android.hardware.camera" />

    <application
        android:icon="@drawable/icon_retina"
        android:label="The Foto Life"
        android:screenOrientation="portrait" >
        <uses-library
            android:name="com.google.android.maps"
            android:required="true" />

        <activity
            android:name=".Splash"
            android:exported="true"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Login"
            android:excludeFromRecents="true"
            android:exported="false"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action android:name="com.fotolife.app.LOGIN" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".MainView"
            android:exported="false"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action android:name="com.fotolife.app.MAINVIEW" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Menu"
            android:exported="false"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action android:name="com.fotolife.app.MENU" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Upload"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:exported="false"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action android:name="com.fotolife.app.UPLOAD" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Map"
            android:exported="false"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action android:name="com.fotolife.app.MAPS" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".AndroidCustomGalleryActivity"
            android:configChanges="keyboardHidden|orientation"
            android:exported="false"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action android:name="com.fotolife.app.GALLERY" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".EditGallery"
            android:configChanges="keyboardHidden|orientation"
            android:exported="false"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action android:name="com.fotolife.app.GALLERY" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".UploadQueue"
            android:configChanges="keyboardHidden|orientation"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar"
            android:windowSoftInputMode="adjustPan" >
        </activity>
        <activity
            android:name="com.aviary.android.feather.FeatherActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:hardwareAccelerated="true"
            android:largeHeap="true"
            android:screenOrientation="portrait"
            android:theme="@style/FeatherDefaultTheme.Custom" />

        <receiver
            android:name="com.aviary.android.feather.receivers.FeatherSystemReceiver"
            android:exported="true"
            android:process=":feather_system_receiver" >
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_ADDED" />
                <action android:name="android.intent.action.PACKAGE_REMOVED" />
                <action android:name="android.intent.action.PACKAGE_REPLACED" />

                <data android:scheme="package" />
            </intent-filter>
        </receiver>

        <provider
            android:name="com.aviary.android.feather.library.providers.FeatherContentProvider"
            android:authorities="com.fotolife.app.upload"
            android:exported="false" >
        </provider>

        <meta-data
            android:name="ADMOB_PUBLISHER_ID"
            android:value="a150e7b057ac915" />
    </application>

</manifest>

我的清单中有一个标签,我可以四处移动并且不会出错。你能告诉我它的正确位置吗?

【问题讨论】:

  • 你能发布你的清单吗?确保您输入了正确的包名。
  • 我发布并检查了。没错。
  • 当您尝试编译应用程序时会发生什么,尝试编译应用程序时,有时我会遇到 Eclipse 在我清理它时不会生成 R.Java,但它会在我编译时创建。
  • eclipse 中查看问题tab 了解更多详情。
  • 您的清单中有多个引用,例如 android:icon、android:label、android:theme。检查这些是否都有效。这些错误在 Eclipse 中不会显示为红色

标签: android resources r.java-file


【解决方案1】:

在 Android SDK 管理器中更新构建工具

【讨论】:

    【解决方案2】:

    删除您的“gen”和“bin”文件夹,然后检查“问题”选项卡(在 Eclipse 中)。我敢打赌,您缺少 XML 引用,或者 XML 文件中有另一个错误(有时不转义斜杠或引号可以做到这一点)。

    最后,检查您的项目属性以确保您仍然以适当的 SDK 版本为目标,并且您的所有库仍然是链接的。

    【讨论】:

      【解决方案3】:

      我发现了问题。我的edit.xml文件中隐藏了一个8.....我摆脱了它,问题得到了解决。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-07-16
        • 1970-01-01
        • 2020-07-15
        • 1970-01-01
        相关资源
        最近更新 更多