1

I dowloaded google-play-services from sdk manager and copy pasted all the code from admob samplebut it is not working. Everything seems perfect only errors produced are R can't be resolved to a variable. Here is a sample error

Error: No resource found that matches the given name (at 'text' with value '@string/load_interstitial').

Here is strings.xml file

<resources>
<string name="app_name">Google Ads SDK Sample</string>
<string name="ad_unit_id">INSERT_YOUR_AD_UNIT_ID_HERE</string>
<string name="load_interstitial">Load Interstitial</string>
<string name="interstitial_not_ready">Interstitial Not Ready</string>
<string name="banner_in_xml">Banner in XML</string>
<string name="banner_in_code">Banner in Code</string>
<string name="interstitial">Interstitial</string>
</resources>
user3404195
  • 189
  • 11

2 Answers2

0

Try to delete the import line import com.your.package.name.app.R, then, any resource calls such as mView= (View) mView.findViewById(R.id.resource_name); will highlight the 'R' with an error, a 'Quick fix' will prompt you to import R, and there will be at least two options:

  1. android.R
  2. your.package.name.R

Select the R corresponding to your package name, and you should be good to go. Hope that helps.

Or.....second region,

Each time I had a problem with R not been generated, or even disappeared, this was due to some problem in the XML layout file that prevented the application from being built.

Lavekush Agrawal
  • 6,040
  • 7
  • 52
  • 85
0

The error in res folder cause missing of R.java filevso please check your res folder for any error.

The error may be with image too any capital letter or blank space can cause missing of R.java file.

Also check all the XML file ,error with res files only

Arun Antoney
  • 4,292
  • 2
  • 20
  • 26