1

Im trying to implement GameAnalytics Plugin into my game. Also, im using AdInCube plugin, which works fine, but now i get an error every time during build. I received exactly the same error when i tried to implement Google Play Services plugin. Problems occur just after the import new package, without any changes in code. I tried to use AndroidManifests from both plugins, but i got this error anyway.

Error:

CommandInvokationFailure: Gradle build failed. 
C:/Program Files/Java/jdk1.8.0_191\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.2.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/GoogleSignInAccount.class

I discovered that Unity creates two the same folders during building and therefore doesnt know which one to use. I cant just delete one of them, because it will be created anew immediately. I have no idea which files you need to help me, so ill add this for now.

MainTemplate.gradle from AdInCube:

buildscript {
    repositories {
        google()
     maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        jcenter()

    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

allprojects {
    repositories {
        flatDir {
            dirs 'libs'
        }
    }
}

apply plugin: 'com.android.application'

repositories {

    maven {
        url 'https://maven.google.com'
    }
    maven {
        url 'http://repository.adincube.com/maven'
    }
    jcenter()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile('com.adincube.sdk:AdinCube-Unity-3626ebe:2.3.1@aar') {
        transitive = true
    }
    compile 'com.android.support:multidex:1.0.1'
    **DEPS**
}

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

    defaultConfig {
        targetSdkVersion '28'
       minSdkVersion 14     
        multiDexEnabled true

    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress '.unity3d', '.ress', '.resource', '.obb'
    }

**SIGN**
    buildTypes {
        debug {
            minifyEnabled **MINIFY_DEBUG**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
            jniDebuggable true
        }
        release {
            minifyEnabled **MINIFY_RELEASE**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
            **SIGNCONFIG**
        }
    }
    packagingOptions {
        exclude 'lib/armeabi/libadcolony.so'
        exclude 'lib/armeabi/libjs.so'
        exclude 'lib/arm64-v8a/libadcolony.so'
        exclude 'lib/arm64-v8a/libjs.so'
        exclude 'lib/x86_64/libadcolony.so'
        exclude 'lib/x86_64/libjs.so'
    }
}
dependencies {
  compile ('com.adincube.sdk:AdinCube-Unity-3626ebe:2.+@aar') {
    transitive = true
  }
  compile 'com.android.support:multidex:1.0.1'
}
repositories {

  maven {
    url 'https://maven.google.com'
  }
  maven {
    url 'http://repository.adincube.com/maven'
  }
jcenter()
}
android {
  defaultConfig {
    multiDexEnabled true
  }
}
android {
  packagingOptions {
    exclude 'lib/armeabi/libadcolony.so'
    exclude 'lib/armeabi/libjs.so'
    exclude 'lib/arm64-v8a/libadcolony.so'
    exclude 'lib/arm64-v8a/libjs.so'
    exclude 'lib/x86_64/libadcolony.so'
    exclude 'lib/x86_64/libjs.so'
  }
}

AndroidManifest from AdInCube:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="games.****.block"
    android:installLocation="preferExternal"
    android:versionCode="2"
    android:versionName="1.1.1">
    <uses-permission android:name="com.android.vending.BILLING" />
    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:xlargeScreens="true" />
    <application
        android:name="android.support.multidex.MultiDexApplication" 
        android:icon="@drawable/app_icon"
        android:label="@string/app_name"
        android:theme="@style/UnityThemeSelector">
        <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>
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • Can you post also the contents of all link.xml files on your plugins? If you are confident a specific plugin introduced the build error, just post the content of its link.xml file. – Angelos Kyriakopoulos Nov 13 '18 at 12:11
  • I have only one link.xml file in assets folder. ` - - - - ` – TheWorstCoder Nov 13 '18 at 12:22
  • Got the same error :/ I read something about adding compile with exclude in mainTemplate, but i have no idea how to find out what. – TheWorstCoder Nov 13 '18 at 15:06
  • It was a longshot anyway. Try to delete the file and let unity regenerate it for you. Try removing and readding plugins during the process, until you find the reason this is happening. Have in mind the embedded link.xml files may be found in the directory per plugin. When I had a similar error, it was due to having all the different platform DLLs of the FacebookSDK referenced in the linx.xml instead of only the android one. Good luck! – Angelos Kyriakopoulos Nov 14 '18 at 07:13
  • Will try. Thanks! :) – TheWorstCoder Nov 14 '18 at 14:24

0 Answers0