Android的R.java不会在Eclipse中产生会在、Android、java、Eclipse

2023-09-05 01:42:53 作者:入戏太深i

我在Windows 64位在Android SDK 17运行Eclipse 4.2.2朱诺发展与ADT。就在今天,我清理工作的项目,才发现R.java文件将不再产生。

I am running Eclipse 4.2.2 Juno on Windows 64-bit for development on Android SDK 17 with ADT. Just today, I cleaned a working project, only to find that the R.java file would no longer generate.

该问题有可能导致一个非常不同的列表。用户灰色,响应于位于这里线程,列举了一组文章中,针对所有不同的可能原因。

This problem has a very divergent list of possible causes. User Gray, in response to the thread located here, listed a set of articles, all addressing different possible causes.

他说:

别担心。首先,你可以清理项目,然后运行该项目。如果   这不起作用然后按照下面的链接:

Dont worry. First you may clean the project, then run the project. If this does not work then follow the following links:

和然后前进到列表有关这一问题的不同的原因制品中,它联结到哪个我无法包括,但可以在连接到上面的问题被发现。

And then proceeds to list articles pertaining to different causes of this problem, the links to which I am unable to include, but can be found in the question linked to above.

格雷的评论是最常见的原因好好总结这个问题,包括资源文件命名约定,错误的进口Android.R语句,XML错误,腐败需要清理和重建,并检查了Android SDK的项目 - >属性 - > Java构建路径/库

Gray's comment is a good summary of the most common causes to this problem, including resource file naming convention, the erroneous "import Android.R" statement, XML errors, corruption requiring cleaning and rebuilding, and checking the Android SDK in Project -> Properties -> Java Build Path / Libraries.

现在的问题是,我的R.java仍然没有产生!在灰名单唯一剩下的可能性似乎是,无论是我的main.xml或AndroidManifest.xml中被打破,所以我已经包括了他们,以确保我没有错过任何错误。

The problem is, my R.java still doesn't generate! The only remaining possibility within Gray's list seems to be that either my main.xml or AndroidManifest.xml is broken, so I have included them to make sure I didn't miss any errors.

我的主要布局:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.bostonwalker.sseng.SSSurfaceView
    android:id="@+id/ssview"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
</FrameLayout>

和我的清单:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bostonwalker.enginedev"
android:versionCode="1"
android:versionName="1.0" >

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

<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>

作为一个初学者的Andr​​oid程序员,这已经超出了我的能力调试。是否有人可以找出一个解释?

As a beginner Android programmer, this is beyond my capability to debug. Can someone please find an explanation?

推荐答案

如果有你的资源文件中的任何错误,首先检查。如果是这样的话R.java将不会生成。检查您是否已更新了ADT到转速如果是这样按照以下

First check if there are any errors in your resource file's. R.java will not be generated if that's the case. Check if you have updated your adt to rev 22. If so follow the below

右键点击您的项目转到属性。 Java构建路径。选择订单的出口标签。确保Android的私人图书馆被选中。如果您引用的库项目。做相同的库项目也。清理并生成。

Right click on your project goto properties. Java Build Path. Choose Order export tab. Make sure that Android Private Libraries is selected. If you have referenced library project. do the same for the library project also. Clean and Build.

此外转到Android SDK中的经理,并检查是否有Android SDK中建安装的工具。这可能不必要的,但要确保你已经安装了Android编译工具。

Also goto android sdk manager and check that you have the android sdk build tools installed. This many not be necessary but make sure you have android build tools installed.

检查以下

Eclipse错误:R 1不能被解析到一个变量