How to install Repository com.android.support:appc

2019-07-26 07:22发布

问题:

I have an error in my gradle script:

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 :

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 ?

回答1:

Try this:

1) tools -> android -> sdk manager -> Launch 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



回答2:

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.



回答3:

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