0

I've searched extensively for the answer but most answers are outdated and all the rest haven't worked.

I am new to Android studio and am working in it for a project. However, when I put in

import com.example.greenguff.camtest.R;

It tells me that it is unused and everything that references R gets marked with an error. I have also tried

import android.R;

from an answer. No dice on that either. I've messed around in my compiler settings. I've cleaned and rebuilt the project numerous times. I'm at my wit's end. Up-to-date help would be appreciated!

alexforrence
  • 2,724
  • 2
  • 27
  • 30
  • Firstly you should know the package name of the resource that you use. Make sure your project name space is `com.example.greenguff.camtest` or it won't work. Secondly, make sure that R file is generated. – T D Nguyen Mar 11 '15 at 21:27
  • 1
    You don't need to import R.java, see this post: http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error/3259974#3259974 – Daniel Nugent Mar 11 '15 at 21:28
  • @NguyenDoanTung The package name is correct. – user3222124 Mar 11 '15 at 21:50
  • @DanielNugent That question is old and commenting out the import does nothing to fix the lines that use R. Ex: `btnStart = (Button)findViewById(R.id.btn_start);` – user3222124 Mar 11 '15 at 21:51
  • Have you tried to build from command line see exactly what the problem is? gradle clean installDebug --info (or whatever variants you have). – kleinsenberg Mar 11 '15 at 22:21
  • Try **File>Invalidate Caches/ Restart>Invalidate and Restart**. – ben_joseph Sep 11 '15 at 08:38

1 Answers1

-1

Try to Re-build your app and clean it.