L
L
Ler Den2019-04-26 14:05:32
Android
Ler Den, 2019-04-26 14:05:32

Why doesn't the Unity Android build run?

Hello everyone, yesterday the build was still working, but today it refuses.
The original error was

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives

5cc2e5232ae4e052973478.png
I found an article on how to enable Multidex, I thought it would help
https://appmediation.com/unity-enable-multidex/
Total, after all the manipulations, I have
AndroidManifest.xml
spoiler
<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    xmlns:tools="http://schemas.android.com/tools"
    android:installLocation="preferExternal">
    <supports-screens
        android:smallScreens="true"
        android:normalScreens="true"
        android:largeScreens="true"
        android:xlargeScreens="true"
        android:anyDensity="true"/>

    <application
        android:theme="@style/UnityThemeSelector"
        android:icon="@mipmap/app_icon"
        android:label="@string/app_name"
        android:name="android.support.multidex.MultiDexApplication">
        <activity android:name="com.unity3d.player.UnityPlayerActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>
    </application>
</manifest>

mainTemplate.gradle
spoiler
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN

buildscript {
    repositories {
        google()
        jcenter()
    }

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

allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

apply plugin: 'com.android.application'
**APPLY_PLUGINS**

dependencies {
    compile 'com.android.support:multidex:1.0.1'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
**DEPS**}

android {
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        applicationId '**APPLICATIONID**'
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
        multiDexEnabled true
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }**SIGN**

    buildTypes {
        debug {
            // minifyEnabled **MINIFY_DEBUG**
            // useProguard **PROGUARD_DEBUG**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
            jniDebuggable true
        }
        release {
            // minifyEnabled **MINIFY_RELEASE**
            // useProguard **PROGUARD_RELEASE**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
        }
    }**PACKAGING_OPTIONS****SPLITS**
**BUILT_APK_LOCATION**
**EXTERNAL_SOURCES**
    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = false
        }
        abi {
            enableSplit = true
        }
    }
}**SPLITS_VERSION_CODE****REPOSITORIES****SOURCE_BUILD_SETUP**


But now another error is thrown
5cc2e541019bf774148508.png
. What is the problem? Nothing sensible googles

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arthur Petrin, 2019-05-03
@NeYmExa

I had the same error, this site solved it: https://stackoverflow.com/questions/46977267/com-a...

L
Ler Den, 2019-05-19
@givemoneybiatch

Maybe someone will help. In my case, it was solved by disabling the checkbox "Enable built-in Ads extension" in UnityAds

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question