Unity

1.Throwing dex 64k reference error when packaging Android APK.

Take version 2019.4.8f1 as an example, modify file /Applications/Unity/Hub/Editor/2019.4.8f1/PaybackEngines/AndroidPlayer/Tools/GradleTemplate/launcherTemplate.gradle, add "multiDexEnabled true".

android {
        defaultConfig {
            ...
            multiDexEnabled true
            minSdkVersion **MINSDKVERSION**
            targetSdkVersion **TARGETSDKVERSION**
            ...
        }
    }

 

2.Prompt that the gradle version does not match.

gradle_1.png

Manually download the required gralde version compressed package and decompress it, and set the gradle directory in Untiy IDE.

Download link: https://services.gradle.org/distributions/

gradle_2.png

 

3. Manifest attribute merge error.

After some SDKs are adapted to Android 11, the <queries> attribute will be added to the Manifest file. Android Gradle plugin 4.1 and higher are compatible with the new <queries> declaration; however, lower versions are not compatible. If you add the <queries> element or start to rely on libraries or SDKs that support Android 11 as the target platform, you may encounter manifest merge errors when building your app.

Solution: Upgrade the gradle plugin version, https://developer.android.com/studio/releases/gradle-plugin#4-0-0

 

gradle_plugin.png Example : Modify file /Applications/Unity/Hub/Editor/2019.4.8f1/PaybackEngines/AndroidPlayer/Tools/GradleTemplate/baseProjectTemplate.gradle

 dependencies {
classpath 'com.android.tools.build:gradle:3.4.3'
**BUILD_SCRIPT_DEPS**
}

 

 

 

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.