3

My question is about when I updated android studio up to latest version of 3.1 and when open a project then it gives me error and i try to invalidate caches and restart android studio but still error is not gone as shown below Android studio screenshot

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Wahdat Jan
  • 3,988
  • 3
  • 21
  • 46
  • some apps gradle version and android plugin version don't match with yours. So what you need to do, is open a working android project (one you already have). Goto file -> project settings -> project and note down gradle version and android gradle plugin version. Then browse to imported app (which has the problem) and update gradle version and android plugin versions. This will save you installation time. There are alternate methods also. This one is quick. Let me know if it fixes ur issue. – Amir Dora. Mar 28 '18 at 16:19
  • still showing same error @AmirDe – Wahdat Jan Mar 28 '18 at 16:47
  • see the Logcat and paste the result, it will be easier to diagnose the problem. – Amir Dora. Mar 29 '18 at 06:52

6 Answers6

5

SOLVED

  1. Click on File >> Close Project

  2. Delete .idea folder in project Directory

  3. Open Project again

and it works

Wahdat Jan
  • 3,988
  • 3
  • 21
  • 46
0

Go in the gradle settings check the global gradle option. if checked to offline then uncheck it and try reload the project

Shikhar Singh
  • 112
  • 1
  • 11
0

You have to install the right SDK for this project.

0

Check classpath in build.gradle file in Project folder . It should be

  dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    }

and "distributionUrl" in gradle-wrapper.properties ( in path ProjectFolder/gradle/). It also should be updated; like

distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
dev
  • 260
  • 2
  • 12
0

the correct values for the Android 3.1 should be

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.0'

}

and the distribution URL will be

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

then clean and rebuild it should work. I did for few projects today

Sunil Soni
  • 443
  • 3
  • 18
0

set Write permission to android folder