0

i have a layout called "activity_qrtest" inside the layout folder. And when i try to reference this layout in the class as the follows:

setContentView(R.layout.activity_qrtest);

eclipse highlight the layout name "activity_qrtest" with red which means it's not available.

the cosole output:

[2012-09-10 17:15:15 - QRTest] ERROR: resource directory 'D:\workspaceQR\QRTest\res'  
does not exist 
[2012-09-10 17:26:48 - QRTest] 'default' is not a best match for any device/locale  
combination.
[2012-09-10 17:26:48 - QRTest] Displaying it with 'Locale Language ___Region __,  
sw320dp, w320dp, h533dp, Normal Screen, Long screen aspect ratio, Portrait   
Orientation, High Density, Finger-based touchscreen, Soft keyboard, No keyboard,  
Exposed navigation, Trackball navigation, Screen resolution 800x480, API Level 16'   
which is compatible, but will actually be displayed with another more specific   
version of the layout.
[2012-09-10 17:28:41 - QRTest] AndroidManifest.xml file missing!

any suggestions to solve such problem.

Amrmsmb
  • 1
  • 27
  • 104
  • 226
  • Check you included right "R" class. You can accidently include "android.R" instead of R class generated by you project – Dmitry Ryadnenko Sep 10 '12 at 15:47
  • i tried what did u suggest but unfortunately the did not solve the problem – Amrmsmb Sep 10 '12 at 15:50
  • Do you have AndroidManifest.xml file in you project? Post full path to activity_qrtest.xml please – Dmitry Ryadnenko Sep 10 '12 at 15:55
  • yes i have manifest file, but how to post the full bath of the activity_qrtest.xml? i have res folder inside the res folder there layout folder and in the layout folder there is the activity_qrtest.xml – Amrmsmb Sep 10 '12 at 15:59
  • do you have any folders with "-default" suffix inside "res" folder? Can you please paste here names of all folders inside you "res" folder? – Dmitry Ryadnenko Sep 10 '12 at 16:01
  • inside th res folder there are:drawable,drawable-hdpi,drawable-ldpi,drawable-mdpi, layout,layout-land,layout-ldpi,raw,values, another values folder about 20 folder, and xml – Amrmsmb Sep 10 '12 at 16:07
  • Try to close you project and open it again – Dmitry Ryadnenko Sep 10 '12 at 16:20
  • Possible duplicate of [Eclipse and Android XML layouts gives "'default' is not a best match for any device/locale combination"](http://stackoverflow.com/questions/3774686/eclipse-and-android-xml-layouts-gives-default-is-not-a-best-match-for-any-dev) – blahdiblah Oct 30 '13 at 20:38

2 Answers2

1

Check in the Console View if there are any errors in your activity_qrtest.xml file. Most probably your xml is incorrect. Also, try Project|Clean

Alexander Kulyakhtin
  • 47,782
  • 38
  • 107
  • 158
0

Make sure you are importing YourApplication.R and not Android.R in your activity, they sometimes get mixed up.

Also, are you sure you are calling setContentView from the correct context/activity? Sometimes it helps calling it like this (I can't test this right now, but my memory tells me it works something like this):

((Activity)getApplicationContext()).setContentView(R.layout.mylayout);
enp4yne
  • 638
  • 5
  • 21