Gradle构建中:No cached version available for offline mode解决
AS3.X之后的offine Mode(离线模式)从setting中移到了这里:
如果构建慢的话,可以把build.gradle改成这个:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {repositories {mavenLocal()maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }mavenCentral()google()jcenter()}dependencies {classpath "com.android.tools.build:gradle:4.0.1"// NOTE: Do not place your application dependencies here; they belong// in the individual module build.gradle files}
}allprojects {repositories {mavenLocal()maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }mavenCentral()google()jcenter()}
}task clean(type: Delete) {delete rootProject.buildDir
}
mavenLocal()是使用本地Maven仓库,如果之前没有配置过Maven本地仓库可以不加,如果有的话,还需要改一个环境变量(因为我们之前配置的时候默认都是用Maven_HOME配置的):