unity android 打包问题解决

gradle编译问题

打开 gradle所在路径,如:C:\Program Files\Unity 2020.3.30f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\GradleTemplates,
编辑baseProjectTemplate.gradle,替换成阿里云的源

// 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:4.0.1'
            **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
}

android sdk build-tools编译问题

Installed Build Tools revision 33.0.0 is corrupted. Remove and install again using the SDK Manager.

  • 将\build-tools\33.0.0下的d8.bat复制,改名成dx.bat
  • 将\build-tools\33.0.0\lib下的d8.jar复制,改名成dx.jar
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值