Android Studio關於下載某Jar包網路超時問題
阿新 • • 發佈:2018-11-06
1.首先將Android Studio的Settings開啟,然後搜尋Android Studio將Enable embedded Maven repository選項勾選,你也可以通過單擊Build Execution Deployment中的Gradle來找到Android Studio選項
[點選並拖拽以移動]
2.修改build.gradle檔案 如下,其中的註解為核心修改部分
buildscript {
repositories {
//將jcenter()註釋掉,加入先面maven{url'....'}
// jcenter()
maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.mob.sdk:MobSDK:+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
//將jcenter()註釋掉,加入先面maven{url'....'} 還有加入下面的maven { url "https://jitpack.io" }
// jcenter()
maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'}
maven { url "https://jitpack.io" }
}
tasks.withType(Javadoc) {
options {
encoding "UTF-8"
charSet 'UTF-8'
links "http://docs.oracle.com/javase/7/docs/api"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
3、如果build.gradle中google()報某某錯誤的話,可以使用如下程式碼替換
maven {url 'https://maven.google.com'}