0

All of my old projects have been working fine. Then one day, whenever I make a new project, I get :

enter image description here

And in the lower window, Messages Gradle Synch :

enter image description here

Some of the solutions I tried :

How to use the latest gradle version in Android Studio

In gradle-wrapper.properties I already have the up to date version :

distributionUrl=http\://services.gradle.org/distributions/gradle-2.12-all.zip

As suggested in another post, I believe I have the latest version of gradle plugin. In File/Project Structure/Project I have :

enter image description here

Another post on SO said to right click on my Java directory and select from the menu, 'Mark Directory as Source'. But this option does not even appear in my menu. My version of Android Studio is AS 2.1 Preview 5.

I can't select my java folder in blue, as it should be (marked as source) and my MainActivity java file has a funny red symbol. I seem unable to make it a java class file :

enter image description here

Any idea how to solve this problem on this buggy platform?

Community
  • 1
  • 1
CHarris
  • 2,693
  • 8
  • 45
  • 71
  • Have you tried clicking on the "Fix plugin version ... " link? – Sergey Glotov Jun 27 '16 at 22:04
  • @SergeyGlotov Yes, have indeed. I am told the plugin is too old, and to update to a more recent version. – CHarris Jun 27 '16 at 22:10
  • 1
    Latest version of the gradle plugin is 2.2.0-alpha4. Given you are using AS 2.1, may be you need plugin of 2.1.x versions, then it's 2.1.2 version. [List of all versions](https://bintray.com/android/android-tools/com.android.tools.build.gradle/view). BTW, why are you still using preview of AS 2.1? There is stable version 2.1.2 already. – Sergey Glotov Jun 27 '16 at 22:28
  • Possible duplicate of [Android Studio 2.0 - Plugin is too old, please update to a more recent version, or set ANDROID\_DAILY\_OVERRIDE environment variable to](http://stackoverflow.com/questions/34572458/android-studio-2-0-plugin-is-too-old-please-update-to-a-more-recent-version) – Sergey Glotov Jul 01 '16 at 05:25
  • Hope this may help you: https://stackoverflow.com/a/60220536/3974530 – InsaneCat Feb 14 '20 at 05:33

1 Answers1

3

This answer helped :

Android Studio 2.0 - Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to

Basically, in my gradle-wrapper.properties I put this line :

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

// or whatever latest version here : https://services.gradle.org/distributions

In my build.gradle (Project:YourApp) file I put :

classpath 'com.android.tools.build:gradle:2.1.2' //or whatever latest version here : https://bintray.com/android/android-tools/com.android.tools.build.gradle

Then I cleaned my project, rebuilt and now it seems to work ok.

Community
  • 1
  • 1
CHarris
  • 2,693
  • 8
  • 45
  • 71