Search code examples
androidandroid-studioandroid-gradle-pluginbuild.gradleappcompatactivity

implementation 'com.android.support:appcompat-v7:25.4.0' error in app level gradle.build


I working on a project and i add some dependencies to that project. But i got some errors in app level gradle.build file I am using Android Studio 3.1 new version. All settings are default i'm not change anything. All settings are came with new downloaded version with 3.1

Give me a error in this line implementation 'com.android.support:appcompat-v7:25.4.0'

My problem is cannot run project in Android Studio emulator

This is my app level build.gradle file

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 25
        defaultConfig {
            applicationId "com.blogapp.anu.blogapp"
            minSdkVersion 19
            targetSdkVersion 25
            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(include: ['*.jar'], dir: 'libs')

        implementation 'com.android.support:appcompat-v7:25.4.0'
        implementation 'com.android.support:recyclerview-v7:25.4.0'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        implementation 'com.google.firebase:firebase-database:11.0.4'
        implementation 'com.google.firebase:firebase-auth:11.0.4'
        implementation 'com.google.firebase:firebase-storage:11.0.4'
        implementation 'com.google.firebase:firebase-config:11.0.4'
        implementation 'com.google.firebase:firebase-core:11.0.4'
        implementation 'com.google.firebase:firebase-messaging:11.0.4'
        implementation 'com.android.support:cardview-v7:25.4.0'
        implementation 'com.squareup.picasso:picasso:2.71828'
        compile 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
        compile 'com.firebaseui:firebase-ui-database:0.4.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'


    }

    apply plugin: 'com.google.gms.google-services'

Seems i'm using same version for all. And i already read some questions and apply them, but not work for me.

this is my project level

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

    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
            classpath  'com.google.gms:google-services:3.2.1'
        }
    }

    allprojects {
        repositories {
            google()
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }

    task clean(type: Delete) {
        delete rootProject.buildDir
    }

This is my Android SDK Platforms which i using right now Android SDK Platforms Screenshot

And in every instance in all of my classes where I reference R.id.something, the R is in red and it says "cannot resolve symbol R".

Anyone know what wrong with my codes?


Solution

  • add this in app level gradle

    buildToolsVersion '27.0.3' 
    
    
    
     implementation com.android.support:cardview-v7:26.1.0' implementation 'com.android.support:appcompat-v7:26.1.0' implementation 
        'com.android.support:recyclerview-v7:26.1.0 
    

    add this in project level gradle

    classpath 'com.google.gms:google-services:3.2.1'