1.Android Studio 构建空项目报错
我的解决方案
添加如下代码
maven { url "https://jitpack.io" }
maven { url 'https://maven.aliyun.com/repository/releases' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/public' }
2.Unity打包报错 Build Gradle 版本相关报错
我的解决方案
把上面那个文件修改为下面的内容
allprojects {
buildscript {
repositories {**ARTIFACTORYREPOSITORY**
//google()
//jcenter()
maven{ url 'http://maven.aliyun.com/repository/google'}
maven{ url 'http://maven.aliyun.com/repository/gradle-plugin'}
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
maven{ url 'http://maven.aliyun.com/repository/jcenter'}
}
dependencies {
// If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity
// See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html
// See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
// To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version
classpath 'com.android.tools.build:gradle:4.0.1'
**BUILD_SCRIPT_DEPS**
}
}
repositories {**ARTIFACTORYREPOSITORY**
//google()
//jcenter()
maven{ url 'http://maven.aliyun.com/repository/google'}
maven{ url 'http://maven.aliyun.com/repository/gradle-plugin'}
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
maven{ url 'http://maven.aliyun.com/repository/jcenter'}
flatDir {
dirs "${project(':unityLibrary').projectDir}/libs"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这两个报错都是由于代理的问题,(用魔法上网也解决不了)导致不能正常下载需要的文件,加的代码就是添加的代理