r.java 丢失,另一个R.Java文件丢失

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

WhXj7.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值