R.Java从我的项目遗漏,并不会再生 [英] R.Java is missing from my project and will not regenerate

查看:178
本文介绍了R.Java从我的项目遗漏,并不会再生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始做一个新的项目,就像我在我的链接按钮,我发现我的R.将不能解决,会出来找,我的R.java文件不存在了Java。我看着这样的其他问题,他们说要清洁什么我也做了项目,它仍然无法正常工作。下面是从那里它不会解决我的网页code。谢谢!

发票的Java

 包com.invoice;进口android.app.Activity;
进口android.content.Intent;
进口android.os.Bundle;公共类InvoiceActivity延伸活动{
    / **当第一次创建活动调用。 * /
    @覆盖
    公共无效的onCreate(捆绑savedInstanceState){
        super.onCreate(savedInstanceState);
        的setContentView(R.layout.splash);
        螺纹logoTimer =新的Thread(){
            公共无效的run(){
                尝试{
                    睡眠(5000);
                    意图menuIntent =新意图(com.invoice.MENU);
                    startActivity(menu​​Intent);
                }赶上(InterruptedException的E){
                    e.printStackTrace();
                }
                最后{
                    完();
                }
            }
        };
        logoTimer.start();
    }
}

Job.java

 包com.invoice;
进口android.app.Activity;
进口android.os.Bundle;公共类职位扩展活动{
    @覆盖
    保护无效的onCreate(捆绑savedInstanceState){
        // TODO自动生成方法存根
        super.onCreate(savedInstanceState);
        的setContentView(R.layout.job);
    }
}

menu.java

 包com.invoice;进口android.app.Activity;
进口android.content.Intent;
进口android.os.Bundle;
进口android.view.View;
进口android.widget.Button;公共类菜单扩展活动{
    @覆盖
    保护无效的onCreate(捆绑savedInstanceState){
        // TODO自动生成方法存根
        super.onCreate(savedInstanceState);
        的setContentView(R.layout.main);        按钮的工作=(按钮)findViewById(R.id.button4);
        job.setOnClickListener(新View.OnClickListener(){
            公共无效的onClick(视图v){
                startActivity(新意图(com.invoice.job));            }
        });
    }    @覆盖
    保护无效的onPause(){
        // TODO自动生成方法存根
        super.onPause();
    }
}


解决方案

您可能有一个XML文件中的错误。如果有XML错误R.java将不会产生。看看通过你的Manifest.xml和所有的布局,价值观和在res任何其他的XML文件。

一旦你发现并修正错误,清理项目。

I've began making a new project and just as I was linking my buttons to the java I noticed my R would not resolve and come to find out that my R.java file is not there. I've looked at other questions like this and they say to clean the project which I have done and it still does not work. Here is my code from the pages where it wont resolve. Thanks!

Invoice Java

package com.invoice;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class InvoiceActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
        Thread logoTimer = new Thread(){
            public void run(){
                try{
                    sleep(5000);
                    Intent menuIntent = new Intent("com.invoice.MENU");
                    startActivity(menuIntent);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                finally{
                    finish();
                }
            }
        };
        logoTimer.start();
    }
}

Job.java

package com.invoice;


import android.app.Activity;
import android.os.Bundle;

public class Job extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.job);
    }
}

menu.java

package com.invoice;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class menu extends Activity{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button job = (Button) findViewById(R.id.button4);
        job.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                startActivity(new Intent("com.invoice.job"));

            }
        });
    }

    @Override
    protected void onPause() {
        // TODO Auto-generated method stub
        super.onPause();
    }
}

解决方案

You probably have an error in an xml file. R.java will not be generated if there are xml errors. Look through you Manifest.xml and all your layout, values, and any other xml files in res.

Once you have found and fixed the error, clean the project.

这篇关于R.Java从我的项目遗漏,并不会再生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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