AppCompatActivity not playing nice!


Working thrrough the 1st app, with a class starting out in part like this:


      >   import;
        import android.os.Bundle;
        import android.view.Menu;
        import android.view.MenuItem;
        import android.view.View;
        import android.widget.Button;
        import android.widget.Toast;
public class QuizActivity extends AppCompatActivity {

Android Studio “cannot find declaration to go to” on import line of AppCompatActivity AND AppCompatActivity “cannot be resolved” as extends AppCompatActivity.

Under File-- Project Structure I have > Android SDK Location set to the android studio sdk >JDK location to jdk1.8.0_101

In my computer sys environment vars I have PATH, CLASSPATH and JAVA_Home set.

My build.gradle file(app )is:

apply plugin: ‘’

android {
compileSdkVersion 20
buildToolsVersion “20.0.0”

defaultConfig {
    applicationId ""
    minSdkVersion 16
    targetSdkVersion 20
    versionCode 1
    versionName "1.0"
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), ''


dependencies {
compile fileTree(dir: ‘libs’, include: [’*.jar’])

my build.gradle(GeoQuiz) is :

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
dependencies {
classpath ‘’

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files


allprojects {
repositories {

I have googled this problem and looked on this forum. One suggestion was to ignore the problem by extending Activity not AppCompatActivity and get back to the problem later in later chapters.

But I would like to resolve the issue now, so that I have confidence the system is working as it needs to be for the remaining of the book. Also its not best way to start off when trying to learn and you have a barrier knocking your confidence at the first hurdle.

Also some answers online were “over my head” so any step-through process for the resolution would be awesome!