0

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?

Farhana Naaz Ansari
  • 7,524
  • 26
  • 65
  • 105
Sahan Pasindu Nirmal
  • 433
  • 4
  • 13
  • 36

5 Answers5

2

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'
sk sakil
  • 186
  • 1
  • 12
0

try this one

implementation 'com.android.support:appcompat-v7:25.+'

  • 1
    this is look like comment see the link how to paste good answer https://stackoverflow.com/help/how-to-answer – Ali Apr 02 '18 at 06:07
0

Solution 1:

if your doing some Major changes you need to Restart your Android Studios File->Invalidate caches/Restart


Solution 2: If you are using external libs:

Goto File -> Settings -> Compiler now check use external build clean and rebuild..

then rebuild project


Solution 3:

change into buildToolsVersion "25.0.3"

Add dependencies

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
Community
  • 1
  • 1
Gowthaman M
  • 8,057
  • 8
  • 35
  • 54
0

Can you please try replacing the 2 lines

 compile 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
 compile 'com.firebaseui:firebase-ui-database:0.4.0'

with

 implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
 implementation 'com.firebaseui:firebase-ui-database:0.4.0' 

Also, for R not being importing to your packages import statemt, yo can navigate to R keyword in your code and press Alt + Enter and then select import class from the menu.

warezthief
  • 81
  • 1
  • 7
  • Sir replace not worked, and Alt + Enter show me Create Test option – Sahan Pasindu Nirmal Apr 02 '18 at 07:28
  • 1
    @SahanPasinduNirmal Try navigating where you have occurence of "R" in your code and then enter `Alt+Enter`. Also you can try importing the statement yourself as `import com.blogapp.anu.blogapp.R;` – warezthief Apr 02 '18 at 07:33
-1

it is because of your firebase implementation issue...

add this ...

implementation 'com.android.support:appcompat-v7:26.1.0'
sk sakil
  • 186
  • 1
  • 12
  • No sir, it not worked. anyway can you explain more why you called " it is because of your firebase implementation issue " – Sahan Pasindu Nirmal Apr 02 '18 at 06:08
  • 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' modify all this implementation – sk sakil Apr 02 '18 at 06:15
  • can you show me project level gradle.build ...add this classpath 'com.google.gms:google-services:3.2.1' version – sk sakil Apr 02 '18 at 06:16
  • 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.1.0' } } – Sahan Pasindu Nirmal Apr 02 '18 at 06:18
  • classpath 'com.google.gms:google-services:3.1.0' change this to classpath 'com.google.gms:google-services:3.2.1' – sk sakil Apr 02 '18 at 06:20
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/168021/discussion-between-sahan-pasindu-nirmal-and-user8311225). – Sahan Pasindu Nirmal Apr 02 '18 at 06:38