另一个R.Java文件丢失 [英] Another R.Java file missing

查看:147
本文介绍了另一个R.Java文件丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚加入了StackOverflow,因为我没有找到我的问题的任何答案。 (



我已经找到其他线程了,没有似乎修复它..我不知道为什么。



所以基本上,我想做一个Android应用程序,我启动一个新的项目,已经是R.Java缺少(导致重大的问题,我甚至不能从它编译:(),ive尝试: import.android.R; import。(packagename).R; ,ive试图clean它和一堆其他的东西,字面上我可以想到的一切。



发生了什么,如何解决这个问题?

  package com.nicco.compare; 

import android.os。 Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOpti onsMenu(菜单菜单){
//充满菜单;如果存在,则会将项目添加到操作栏。
getMenuInflater()。inflate(R.menu.main,menu);
返回true;
}

}


解决方案

R.java是自动生成的。

  1.你有一个import语句,如import android.R ;.如果这样删除导入

2.你的xml文件中有错误。如果这样修复它们

3.清理并构建项目。

我猜你正在导入 android.R 删除此导入语句( import android.R; )。清洁和建立你的项目。这应该可以解决你的问题。



右键单击项目goto属性选择左侧的android。检查你有正确的版本检查。



同时在清单文件中查找sdk版本




Ive just joined StackOverflow because I just cant find any answers to my problem. :(

I have however found other threads on this, and none seem to fix it.. i have no idea why.

So basically, i am trying to make an android app, i start up a NEW project and already the R.Java is missing (causing major issues, and i can't even compile from it :( ), ive tried: import.android.R;, import.(packagename).R;, ive tried to "clean" it, and a bunch of other stuff. Literally everything i can think of.

What is going on, and how can I fix this?

 package com.nicco.compare;

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

  public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

  }

解决方案

R.java is auto generated.

 1. Do you have a import statement like import android.R;. If so remove the import

 2. Do you have errors in your xml files. If so fix them

 3. Clean and build project.

My guess your are importing android.R Remove this import statement(import android.R;). Clean and build you project. this should solve your problem.

Right Click on project goto properties choose android on the left. Check you have the right version checked.

Also look for the sdk version in manifest file

这篇关于另一个R.Java文件丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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