Unity Game error after adding new plugins

672 Views Asked by At

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>
0

There are 0 best solutions below