Cannot find symbol R when Updating to Android 3.1.3

Yesterday i updated Android to Android 3.1.3, everything was kinda good until, today when i created a new Empty Activity and on "AppCompatActivity" showed me the error "cannot find the symbol", so then I searched and I read it had something to do with the "build.gradle", so I've been updating the libraries and got different errors, the latest one is that object "R" cannot resolve symbol. So here what I've got.

I've had many attempts to solve it (as you can see the comments in the code) but so far i haven't solve it. Please Help me!

Also in one section Android suggested me to change in the gradle.properties # org.gradle.parallel=true from false, and it didn't work either.

build.gradle

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.3'
        //classpath 'com.android.tools.build:gradle:2.1.3'
        //classpath 'com.android.tools.build:gradle:3.2.0-alpha17'
        //classpath 'com.android.tools.build:gradle:3.1.3'
        //classpath 'com.google.gms:google-services:3.2.0'
        //classpath 'com.android.tools.build:gradle:3.1.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            //name 'Google'
        }
    }
}

dependecies

android {
    compileSdkVersion 23
    buildToolsVersion '24.0.2'

    defaultConfig {
        applicationId "com.example.dell.getspeed"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

dependencies {

    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    //compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
    compile 'net.gotev:uploadservice:2.1'
    compile 'com.mcxiaoke.volley:library-aar:1.0.1'
    compile 'com.google.android.gms:play-services-maps:9.8.0'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'

    /*implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'


    /*implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    //implementation 'com.android.support:appcompat-v7:27.1.0'
    //implementation 'com.android.support:design:26.4.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:25.4.0'
    compile 'com.github.anastr:speedviewlib:1.2.0'
    compile 'com.android.support:design:25.4.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    //compile 'com.android.support.constraint:constraint-layout:1.1.2'*/
}

gralde-wrapper.propierties

distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

LOGS: Logs

3 answers

  • answered 2018-07-12 07:12 Tom Patel

    Close the project and import it again. Worked for me today.

    OR

    For some reason, those attributes are not found anymore in the 26 libraries. For increasing those libraries you have to also increase your compileSdk to 27. It is probable you will also have to download the sdk 27

    Short version, following goes on the app `graddle``

    change compile to implementation

        apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 27
        defaultConfig {
            applicationId "cl.cutiko.testingupdate"
            minSdkVersion 21
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:27.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        implementation 'com.android.support:design:27.1.0'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.1'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    }
    

    build.gradle (Project)

    buildscript {
    
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.0'
    
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

  • answered 2018-07-12 07:16 Mbuodile Obiosio

    distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
    
    classpath 'com.android.tools.build:gradle:3.1.3'
    
    compileSdkVersion 27
    minSdkVersion 16
    targetSdkVersion 27
    
    implementation 'com.android.support:appcompat-v7:23.4.0'
    implementation 'com.android.support:design:23.4.0'
    implementation 'com.android.support:support-v4:23.4.0'
    implementation 'com.android.support:recyclerview-v7:23.4.0'
    

    File - Invalidate Caches/Restart - Invalidate and Restart

  • answered 2018-07-12 08:54 Nishan Iddamalgoda

    Close the current project and again reopen it and rebuild solution. Most of the time by rebuilding the solution, "R cannot resolve" problem can be solved.