Gradle和github存储库,同步缓慢
从今天早上开始,我在Android Studio上的android项目中遇到了一个奇怪的问题. Gradle同步非常慢.我搜索发现这是由于github存储库所致.
Since this morning, I have a strange problem on my android project on Android Studio. Gradle sync is very slow. I search and find that it is due to a github repositories.
我设法使用这个build.gradle在新的android studio项目上重现此错误
I manage to reproduce this bug on a new android studio project with this build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
allprojects {
repositories {
maven { url 'https://raw.githubusercontent.com/bbbenja/mvn-repo/master/' }
mavenCentral()
}
}
Github是否更改其对原始文件的策略?有人有同样的问题吗?
Github change its strategy on raw files ? Is anyone have the same problem ?
Thx
我遇到了同样的问题-我们的整个Android项目都无法构建,因为我们依赖于Github托管的mvn存储库.
I just ran into the same issue-- our entire Android project would not build because we have a dependency on a Github hosted mvn repository.
这似乎是Github的问题.他们的原始"托管似乎无法正常工作.
This appears to be a problem with Github. It seems like their "raw" hosting isn't working.
这是我的临时解决方法:
This was my temporary workaround:
1)Git在本地克隆存储库
1) Git clone the repo locally
2)在本地使用MAMP或其他Web服务器,将其指向下载mvn-repo文件夹的位置
2) Use MAMP or another web server locally, point it to where you download the mvn-repo folder
3)在您的构建文件中,根据您的Web服务器将其设置为localhost ...
3) In your build file, set it to localhost... according to your web server
例如,这是我们的build.gradle现在的样子:
For example this is what our build.gradle looks like now:
repositories {
// this maven repo is a source for the compile dependencies
//maven { url 'https://github.com/Goddchen/mvn-repo/raw/master/'}
//temporary workaround
maven { url 'http://localhost:8888/' }
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
flatDir name: 'libs', dirs: "libs"
}