2019安卓打包只有gradle模式了,由于谷歌把adt删了html
unity2019能够自定义gradle模板,国内请把repo地址改为阿里云的源android
引擎版本:unity2019.3.7f1json
android sdk,我仅保留28,29三个平台,system-images 仅保留23,29压缩后是2.5G,Android SDK Tools Version>26.1.1maven
jdk提示须要JDK1.8 64位gradle
家里电脑上安装的是:openjdk/16,打包会弹出提示版本不匹配,因此仍是请安装JDK而不是OpenJDKui
华为JDK国内镜像:https://mirrors.huaweicloud.com/openjdk/google
此环境配置打包出来的APK可在mumu模拟器安卓6.0上正常跑阿里云
在断网的状况下,使用unity2018.4.15在打包apk时会报没法链接到远程的google.xxx,没法打包出apk,尝试过从其它电脑拷贝.gradle到打包机上,仍是出现同样的提示,因此放弃离线的方法。url
以unity2019.3.7f1为例,在Unity的安装目录下,找到:PlaybackEngines/AndroidPlayer/Tools/GradleTemplates/baseProjectTemplate.gradlespa
替换这个文件的内容为以下,重启Unity进行build,下载一次以后后面build就会很快了。
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN allprojects { buildscript { repositories {**ARTIFACTORYREPOSITORY** maven{ url 'https://maven.aliyun.com/repository/google'} //google() maven{ url 'https://maven.aliyun.com/repository/jcenter'} //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:3.4.0' **BUILD_SCRIPT_DEPS** } } repositories {**ARTIFACTORYREPOSITORY** maven{ url 'https://maven.aliyun.com/repository/google'} //google() maven{ url 'https://maven.aliyun.com/repository/jcenter'} //jcenter() flatDir { dirs "${project(':unityLibrary').projectDir}/libs" } } } task clean(type: Delete) { delete rootProject.buildDir }