如何在没有SDK Manager的情况下手动下载并添加v7-appcompat库?

4

我查看了这个链接:

https://developer.android.com/tools/support-library/setup.html

它说我应该使用SDK Manager下载并添加v7-appcompat,然而我必须通过代理连接到互联网,当我使用SDK Manager时它无法下载任何东西。

那么我该如何下载并添加v7-appcompat呢?

我知道如何使用代理,但是代理会使我的网络速度变慢,所以SKD Manager会出现超时消息。

(我想要使用Material Design,但是当我使用此主题:Theme.AppCompat.Light.DarkActionBar时,它无法解决,我在网上进行了检查,并发现我需要添加v7-appcompat,但没有任何文件夹类似于extras\android\support)


可能是在服务器代理后设置Android SDK?的重复问题。 - Ivan Aksamentov - Drop
我知道如何使用代理,但是当我使用它时,SDK无法下载任何东西,因为超时了。我的带宽很差,而代理使情况更糟。 - Taher
好的。我在搜索了5分钟后找到了这个:https://github.com/koush/android-support-v7-appcompat/tree/master/libs - Ivan Aksamentov - Drop
此外,Android 是一个开源项目,如果你足够勇敢,可以下载源代码并自己构建。 - Ivan Aksamentov - Drop
2个回答

6

手动下载步骤:

  • Run SDK manager at least once after installation, so it would create its config folder.
  • Find .android folder in your home folder (~ on *nix, C:\Users\<username> on Windows)
  • Open sites-settings.cfg
  • Pick a repository string that will likely contain your package (repo names after = sign could give you a clue). In your case it will be:

    @name@https\://dl.google.com/android/repository/addon-6.xml=Google Inc.
    
  • Paste picked URL into a browser address bar:

    https://dl.google.com/android/repository/addon-6.xml
    
  • You will see an XML file that describes downloads available in the repository. We are interested in:

    <sdk:name-display>Android Support Library</sdk:name-display>
    
  • Just below you could find a direct download URL.

    <sdk:url>support_r19.1.zip</sdk:url>
    
  • Now, it can be absolute path or relative path. In our case it is relative path. Just add the absolute current path before it. We are now on:

    https://dl.google.com/android/repository/
    

    so, the link will be

    https://dl.google.com/android/repository/support_r19.1.zip
    
  • If you don't find desired files, just try another repository

请注意,在中国大陆 https://dl.google.com 可能会被屏蔽。您需要自己找到解决此问题的方法。 ;)

0

我错过了:

allprojects {
    repositories {
        maven {url "https://maven.google.com"}
    }
}

在我的项目级别的Gradle文件中,添加了这个内容,它就像魔法一样奏效了。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接