1

I have an error in my gradle script:

enter image description here

In my app (gradle) I have:

buildToolsVersion "25.0.2"

How can I install the corresponding appcompat lib ? When tryping to add ...

compile 'com.android.support:appcompat-v7:25.0.2'

... I get an error and the following picture :

enter image description here

When clicking on the link, nothing happens. Can someone guide me to install the lib ?

UPDATE Following screenshot shows, I obviously installed the support libraries, but then how can I get rid of the red line ? What about this ? I happens sometimes, that when publishing to google play, some libraries are missing. I can't recognize this in my local installation, but after publishing, lots of users reporting class not found. After cleaning and rebuilding and republishing it works. So I like to have a clean gradle script.

Can someone guide me , how I get rid of this red line. Or can we just ignore it ?

I am also not able to start SDK-Manager from C:\Users\andreas\AppData\Local\Android\Sdk\tools\bin directly.

Is it really not possible to solve this ?

enter image description here

mcfly soft
  • 11,289
  • 26
  • 98
  • 202

3 Answers3

2

Try this:

1) tools -> android -> sdk manager -> Launch Standalone SDK Manager

menu

standalone sdk manager

2) find "extras -> Android support repository" and check it (uncheck other for faster installing)

3) click install

Tip: Also use File -> Invalidate Caches / Restart if android studio does something strange. It may help in some cases

Upd: As Gabriele Mariotti mentioned it only works for existing libraries :)

Upd 2: it seems that standalone version was deprecated. You can update from settings window. Standalone SDK Manager option in Android Studio 2.3

Also all com.android.compat libraries in the Gradle file should be with the same version. The last one is 25.3.1

Christos Lytras
  • 36,310
  • 4
  • 80
  • 113
Ivan Shafran
  • 591
  • 2
  • 17
  • Went to tools-> android-> sdkmanager. Fine so far, but where is standalone sdk manager ? – mcfly soft May 04 '17 at 14:20
  • @mcflysoft I added new pic "standalone sdk manager". You could check it. – Ivan Shafran May 04 '17 at 16:41
  • Dear Ivan. Thanks a lot for your effort in explanation with pictures, but I do not have that link. I updated to 2.3 and it has disappeared. I still don't know howto get rid of this red line in my gradle script. – mcfly soft May 05 '17 at 05:27
  • @mcflysoft First of all take a look at Gabriel Mariotti answer. You should change version to existing variant. For example to 25.3.1. Also you should set this version for all com.android.support: in the Gradle file. Oh, sorry about this pic. I found out that is deprecated in the latest update. Sad story. It was very comfortable as for me. You also can update it from settings window. I didn't get it at first but it seems that you already have the latest version of support rep. Just change it to existing one and it should solve you problem. – Ivan Shafran May 05 '17 at 10:50
1

This happens because the support libraries v 25.0.2 doesn't exist.
You can check here all the revisions.

Also:

How can I install the corresponding appcompat lib?

Pay attention. There isn't a relation between the version of the build tools and the support libraries.

To install the support repository just run the SDK Manager.

Esmaeil MIRZAEE
  • 1,110
  • 11
  • 14
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • Thanks. But can you explain in simple words, where I have to click to install the right library so I get rid of the red line ? – mcfly soft May 05 '17 at 05:29
  • Having the same issue. My project requires `com.android.support:appcompat-v4:24.0.0` but I'm driving myself crazy attempting to install it. THERE'S NO WAY – Jason Gaare May 05 '17 at 16:47
-1

This is most likely happen try to remove gradle folder from window c:/user/gradle, and restart setup again.

clemens
  • 16,716
  • 11
  • 50
  • 65