R档缺少的android [英] R file is missing android

查看:189
本文介绍了R档缺少的android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用Eclipse太阳神,但由于性能问题,我改变了对Eclipse伽利略和安装ADT堵漏,并加入我的SDK文件夹Elcipse preferences。现在R.java从我所有的项目消失了。我怎样才能解决这个问题,我没有项目/洁净,但不会生成文件,没有什么错在我的xml和有一个在我的任何项目,没有out.xml。

i was using Eclipse Helios but due to performance issues i changed to Eclipse Galileo and installed the ADT plugging, and added my sdk folder to Elcipse Preferences. Now R.java disappeared from all of my projects. How can i fix this, i did Project/Clean but that won't generate the files, there's nothing wrong in my xml and there's no out.xml in any of my projects.

在此先感谢

推荐答案

今天我有同样的问题,理解了它。这种情况常常包括外部时,原因/示例文件是因为很多时候,这些实例引用布局在您的应用程序,但没有进入包,因此无法看到该包中的R.java文件。为把事情说清楚,这里的R.java文件的开头:

I had this same issue today and figured it out. The reason this happens so often when including external/example files is because often times these examples reference layouts in your application, but do not have access to the package and therefore cannot see the R.java file in that package. to make things clear, here's the beginning of the R.java file:

/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package com.conceptualsystems.dashboard;

public final class R {
    public static final class attr {
    }
    public static final class drawable {
        public static final int csc_logo=0x7f020000;
        public static final int icon=0x7f020001;
    }
    public static final class id {
        public static final int activation_code=0x7f070012;
        public static final int alpha_bar=0x7f07000b;
        public static final int alpha_label=0x7f07000a;

注意包的名称是任何应用程序的包名是。的.java未包含在这个套件文件(即,你只是下降的例子code)将需要明确地引用包文件是这样的:

notice the package name is whatever the package name of your application is. .java files that are not included in this package (ie, your example code you just dropped in) will need to explicitly reference that package file like this:

package com.example.android.apis.graphics;

import android.app.Dialog;
import android.content.Context;
import android.graphics.*;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.SeekBar;
import com.conceptualsystems.dashboard.R;

最后一行是一个讲究。明确导入资源后,资源将成为你的榜样code可用。

the last line is the one to pay attention to. after importing the resources explicitly, the resources will be available in your example code.

这篇关于R档缺少的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆