添加新插件后出现Unity游戏错误

时间:2018-11-13 10:00:34

标签: android unity3d plugins gameanalytics

我正在尝试在我的游戏中实现GameAnalytics插件。另外,即时通讯使用的是AdInCube插件,效果很好,但是现在每次构建时都会出现错误。尝试实施Google Play服务插件时,我收到了完全相同的错误。导入新程序包后,没有任何代码更改,就会出现问题。我试图从两个插件中使用AndroidManifests,但无论如何我还是遇到了这个错误。

错误:

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

我发现Unity在构建期间创建了两个相同的文件夹,因此不知道要使用哪个文件夹。我不能只删除其中之一,因为它将立即重新创建。 我不知道您需要帮助哪些文件,所以请暂时添加。

来自AdInCube的MainTemplate.gradle:

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'
  }
}

来自AdInCube的AndroidManifest:

<?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 个答案:

没有答案