title: Error: cannot find symbol class Compilation
body: <p>I made my app successfully. Now, after following this tutorial(<a href="http://androidmkab.com/2016/02/23/android-implementing-admob-interstitial-ad-and-banner-ad-in-android-app/" rel="nofollow noreferrer">Implementing AdMob into your app</a>), I started to receive errors. After researching for over 4 days, I've found no solution so far. I've tried renaming the classes, but that did not do any good. I did clean my project, which was successful, but when I rebuilt it, I received the following errors:</p>
  <blockquote>
  <p>Error:(59, 13) error: cannot find symbol class InterstitialAd</p>
  <p>Error:(60, 5) error: cannot find symbol class InterstitialAd</p>
  <p>Error:(70, 9) error: cannot find symbol class AdView</p>
  <p>Error:(70, 27) error: cannot find symbol class AdView</p>
  <p>Error:(71, 9) error: cannot find symbol class AdRequest</p>
  <p>Error:(71, 44) error: package AdRequest does not exist</p>
  <p>Error:(75, 28) error: cannot find symbol class InterstitialAd</p>
  <p>Error:(81, 40) error: cannot find symbol class AdListener</p>
  </blockquote>
  <p>Here's the Script for MainActivity.java:</p>
  <pre><code>package com.mycompany.testimage;
  
  import com.mycompany.testimage.R;
  import android.annotation.TargetApi;
  import android.graphics.RectF;
  import android.os.Build;
  import android.os.Bundle;
  import android.os.Handler;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentPagerAdapter;
  import android.support.v4.util.SparseArrayCompat;
  import android.support.v4.view.ViewPager;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.widget.Toolbar;
  import android.text.Spannable;
  import android.text.SpannableString;
  import android.util.TypedValue;
  import android.view.View;
  import android.view.animation.AccelerateDecelerateInterpolator;
  import android.widget.ImageView;
  import android.widget.ScrollView;
  import android.widget.TextView;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.net.Uri;
  import android.os.Bundle;
  import android.content.Intent;
  
  import com.astuetz.PagerSlidingTabStrip;
  import com.flaviofaria.kenburnsview.KenBurnsView;
  import com.nineoldandroids.view.ViewHelper;
  
  import java.util.Random;
  
  public class MainActivity extends ActionBarActivity implements ScrollTabHolder, ViewPager.OnPageChangeListener {
  
  private static AccelerateDecelerateInterpolator sSmoothInterpolator = new AccelerateDecelerateInterpolator();
  
  private KenBurnsView mHeaderPicture;
  private View mHeader;
  private PagerSlidingTabStrip mPagerSlidingTabStrip;
  private ViewPager mViewPager;
  private PagerAdapter mPagerAdapter;
  private Toolbar toolbar;
  private TextView title;
  private ImageView icon;
  private int mActionBarHeight;
  private int mMinHeaderHeight;
  private int mHeaderHeight;
  private int mMinHeaderTranslation;
  private ImageView mHeaderLogo;
  private RectF mRect1 = new RectF();
  private RectF mRect2 = new RectF();
  private TypedValue mTypedValue = new TypedValue();
  private SpannableString mSpannableString;
  private AlphaForegroundColorSpan mAlphaForegroundColorSpan;
  private InterstitialAd interstitial;
  InterstitialAd mInterstitialAd;
  
  int[] photos={R.drawable.photo1, R.drawable.phpto2, R.drawable.photo3, R.drawable.photo4, R.drawable.photo5, R.drawable.photo6, R.drawable.photo7, R.drawable.photo8, R.drawable.photo9};
  KenBurnsView imageView;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      AdView mAdView = (AdView) findViewById(R.id.adView);
      AdRequest adRequest = new AdRequest.Builder().build();
      mAdView.loadAd(adRequest);
  
  // Prepare the Interstitial Ad
      interstitial = new InterstitialAd(MainActivity.this);
  // Insert the Ad Unit ID
      interstitial.setAdUnitId(getString(R.string.admob_interstitial_id));
  
      interstitial.loadAd(adRequest);
  // Prepare an Interstitial Ad Listener
      interstitial.setAdListener(new AdListener() {
          public void onAdLoaded() {
              // Call displayInterstitial() function
              displayInterstitial();
          }
      });
  
      mMinHeaderHeight = getResources().getDimensionPixelSize(R.dimen.min_header_height);
      mHeaderHeight = getResources().getDimensionPixelSize(R.dimen.header_height);
      mMinHeaderTranslation = -mMinHeaderHeight + getActionBarHeight();
  
      setContentView(R.layout.activity_main);
      imageView =(KenBurnsView) findViewById(R.id.header_picture);
      toolbar = (Toolbar) findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
      icon = (ImageView) findViewById(R.id.icon);
      title = (TextView) findViewById(R.id.title);
      mSpannableString = new SpannableString(getString(R.string.actionbar_title));
  
      mHeaderLogo = (ImageView) findViewById(R.id.header_thumbnail);
      mHeader = findViewById(R.id.header);
      mPagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
      mViewPager = (ViewPager) findViewById(R.id.pager);
      mViewPager.setOffscreenPageLimit(4);
      mPagerAdapter = new PagerAdapter(getSupportFragmentManager());
      mPagerAdapter.setTabHolderScrollingContent(this);
      mViewPager.setAdapter(mPagerAdapter);
      mPagerSlidingTabStrip.setViewPager(mViewPager);
      mPagerSlidingTabStrip.setOnPageChangeListener(this);
      mAlphaForegroundColorSpan = new AlphaForegroundColorSpan(0xffffffff);
      ViewHelper.setAlpha(getActionBarIconView(), 0f);
  
      getSupportActionBar().setBackgroundDrawable(null);
  
      final Handler handler = new Handler();
      Runnable runnable = new Runnable() {
          int i=0;
          public void run() {
              // change images randomly
              Random ran=new Random();
              int i=ran.nextInt(photos.length);
              //set image resources
              imageView.setImageResource(photos[i]);
              i++;
              if(i&gt;photos.length-1)
              {
                  i=0;
              }
              handler.postDelayed(this, 7000);  //for interval...
          }
      };
      handler.postDelayed(runnable, 7000); //for initial delay..
  }
  
  public void displayInterstitial() {
  // If Ads are loaded, show Interstitial else show nothing.
      if (interstitial.isLoaded()) {
          interstitial.show();
      }
  }
  
  @Override
  public void onPageScrollStateChanged(int arg0) {
      // nothing
  }
  
  @Override
  public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
      // nothing
  }
  
  @Override
  public void onPageSelected(int position) {
      SparseArrayCompat&lt;ScrollTabHolder&gt; scrollTabHolders = mPagerAdapter.getScrollTabHolders();
      ScrollTabHolder currentHolder = scrollTabHolders.valueAt(position);
      currentHolder.adjustScroll((int) (mHeader.getHeight() + ViewHelper.getTranslationY(mHeader)), mHeaderHeight);
  
  }
  
  @Override
  public void onScroll(ScrollView view, int x, int y, int oldX, int oldY, int pagePosition)
  {
      if (mViewPager.getCurrentItem() == pagePosition)
      {
          mHeader.setTranslationY(Math.max(-view.getScrollY(), mMinHeaderTranslation));
          float ratio = clamp(mHeader.getTranslationY() / mMinHeaderTranslation, 0.0f, 1.0f);
          interpolate(mHeaderLogo, getActionBarIconView(), sSmoothInterpolator.getInterpolation(ratio));
          setTitleAlpha(clamp(5.0F * ratio - 4.0F, 0.0F, 1.0F));
      }
  }
  
  @Override
  public void adjustScroll(int scrollHeight,int headerTranslationY) {
      // nothing
  }
  
  
  
  public static float clamp(float value, float max, float min) {
      return Math.max(Math.min(value, min), max);
  }
  
  private void interpolate(View view1, View view2, float interpolation) {
      getOnScreenRect(mRect1, view1);
      getOnScreenRect(mRect2, view2);
  
      float scaleX = 1.0F + interpolation * (mRect2.width() / mRect1.width() - 1.0F);
      float scaleY = 1.0F + interpolation * (mRect2.height() / mRect1.height() - 1.0F);
      float translationX = 0.5F * (interpolation * (mRect2.left + mRect2.right - mRect1.left - mRect1.right));
      float translationY = 0.5F * (interpolation * (mRect2.top + mRect2.bottom - mRect1.top - mRect1.bottom));
  
      ViewHelper.setTranslationX(view1, translationX);
      ViewHelper.setTranslationY(view1, translationY - ViewHelper.getTranslationY(mHeader));
      ViewHelper.setScaleX(view1, scaleX);
      ViewHelper.setScaleY(view1, scaleY);
  }
  
  private RectF getOnScreenRect(RectF rect, View view) {
      rect.set(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
      return rect;
  }
  
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  public int getActionBarHeight() {
      if (mActionBarHeight != 0) {
          return mActionBarHeight;
      }
  
      if(Build.VERSION.SDK_INT &gt; Build.VERSION_CODES.HONEYCOMB){
          getTheme().resolveAttribute(android.R.attr.actionBarSize, mTypedValue, true);
      }else{
          getTheme().resolveAttribute(R.attr.actionBarSize, mTypedValue, true);
      }
  
      mActionBarHeight = TypedValue.complexToDimensionPixelSize(mTypedValue.data, getResources().getDisplayMetrics());
  
      return mActionBarHeight;
  }
  
  private void setTitleAlpha(float alpha) {
      mAlphaForegroundColorSpan.setAlpha(alpha);
      mSpannableString.setSpan(mAlphaForegroundColorSpan, 0, mSpannableString.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
      title.setText(mSpannableString);
  }
  
  private ImageView getActionBarIconView() {
      return icon;
  }
  
  public class PagerAdapter extends FragmentPagerAdapter {
  
      private SparseArrayCompat&lt;ScrollTabHolder&gt; mScrollTabHolders;
      private final String[] TITLES = { &quot;Home&quot;, &quot;Install&quot;, &quot;About&quot;, &quot;Media&quot;, &quot;Survey&quot;, &quot;Upcoming&quot;, &quot;News&quot;, &quot;Help&quot;, &quot;Credits&quot;, &quot;Share&quot;, &quot;More&quot;};
      private ScrollTabHolder mListener;
  
      public PagerAdapter(FragmentManager fm) {
          super(fm);
          mScrollTabHolders = new SparseArrayCompat&lt;ScrollTabHolder&gt;();
      }
  
      public void setTabHolderScrollingContent(ScrollTabHolder listener) {
          mListener = listener;
      }
  
      @Override
      public CharSequence getPageTitle(int position) {
          return TITLES[position];
      }
  
      @Override
      public int getCount() {
          return TITLES.length;
      }
  
      @Override
      public Fragment getItem(int position) {
          ScrollTabHolderFragment fragment = (ScrollTabHolderFragment) ScrollViewFragment.newInstance(position);
          mScrollTabHolders.put(position, fragment);
          if (mListener != null) {
              fragment.setScrollTabHolder(mListener);
          }
          return fragment;
      }
  
      public SparseArrayCompat&lt;ScrollTabHolder&gt; getScrollTabHolders() {
          return mScrollTabHolders;
      }
  
      }
  
      public class LinkButtons extends Activity {
  
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.main);
          }
  
          public void goToSo (View view) {
              goToUrl ( &quot;http://stackoverflow.com/&quot;);
          }
  
          public void goToSu (View view) {
              goToUrl ( &quot;http://superuser.com/&quot;);
          }
  
          private void goToUrl (String url) {
              Uri uriUrl = Uri.parse(url);
              Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
              startActivity(launchBrowser);
          }
  
      }
  
  }
  </code></pre>
  <p>Android build.gradle</p>
  <pre><code>apply plugin: 'com.android.application'
  
  android {
  compileSdkVersion 21
  buildToolsVersion &quot;21.0.1&quot;
  
  defaultConfig {
      applicationId &quot;com.xrevolt.mmxstructures&quot;
      minSdkVersion 14
      targetSdkVersion 21
      versionCode 2
      versionName &quot;1.2.0&quot;
  }
  
  buildTypes {
      release {
          apply plugin: 'announce'
          /*
          runProguard false
          */
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
  }
  }
  
  dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.android.support:appcompat-v7:21.0.+'
  compile 'com.android.support:cardview-v7:21+'
  compile 'com.flaviofaria:kenburnsview:1.0.5'
  compile 'com.jpardogo.materialtabstrip:library:1.0.6'
  compile 'com.nineoldandroids:library:2.4.0'
  compile 'com.google.android.gms:play-services-ads:8.4.0'
  }
  </code></pre>