Unity导出中的android支持编译的Gradle问题

时间:2017-01-11 10:13:32

标签: unity3d gradle android-gradle

我在Unity中编译项目时遇到了multidex问题,因此我导出了项目并将其导入gradle。我修复了大多数依赖项,但我无法摆脱以下问题:

FAILURE: Build failed with an exception.
12:05:17.012 [ERROR] [org.gradle.BuildExceptionReporter] 
12:05:17.012 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
12:05:17.012 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':mainProj:transformClassesWithJarMergingForRelease'.
12:05:17.012 [ERROR] [org.gradle.BuildExceptionReporter] > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/compat/BuildConfig.class
12:05:17.012 [ERROR] [org.gradle.BuildExceptionReporter] 

这适用于所有支持*项目。我有其他sdks的类似问题,但我通过从他们的classes.jar文件中删除BuildConfig.class来修复它们。出于某种原因,当我为supportcompat2500项目删除这个类时(在这个具体的例子中)它会不断回来 - 而且我不知道从哪里开始。

我的settings.gradle是:

include ':amazonAppStore'
include ':appLovin'
include ':chartboost'
include ':googleAIDL'
include ':googlePlay'
include ':heyzap'
include ':oneSignalConfig'
include ':samsungApps'
include ':shortcutBadger115'
include ':unityAds'
include ':vungle'
include ':animatedvectordrawable2500'
include ':cardviewv72340'
include ':common'
include ':customtabs2340'
include ':facebookandroidsdk4170'
include ':facebookandroidwrapper790'
include ':onesignalunity'
include ':playservicesads980'
include ':playservicesadslite980'
include ':playservicesbase980'
include ':playservicesclearcut980'
include ':playservicesgass980'
include ':playservicesgcm980'
include ':playservicesiid980'
include ':playserviceslocation980'
include ':playservicestasks980'
include ':supportcompat2500'
include ':supportcoreui2500'
include ':supportcoreutils2500'
include ':supportfragment2500'
include ':supportmediacompat2500'
include ':supportv42500'
include ':supportvectordrawable2500'
include ':mainProj'

mainProj.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.3"

    defaultConfig {
        applicationId "com.mainProj.mainProj"
        minSdkVersion 15
        targetSdkVersion 24

        // Enabling multidex support.
        multiDexEnabled true
    }

    lintOptions {
        quiet true
        abortOnError false
        ignoreWarnings true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    sourceSets {
        main {
            manifest.srcFile 'src/main/AndroidManifest.xml'
            java.srcDirs = ['src/main/java.com.mainProj.mainProj']
            resources.srcDirs = ['src/main/res']

            renderscript.srcDirs = ['src']
            res.srcDirs = ['src/main/res']
            assets.srcDirs = ['src/main/assets.bin.Data']
            jniLibs.srcDirs = ['src/main/jniLibs']
        }

        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

dependencies {
    compile 'com.android.support:multidex:1+'
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':amazonAppStore')
    compile project(':appLovin')
    compile project(':chartboost')
    compile project(':googleAIDL')
    compile project(':googlePlay')
    compile project(':cardviewv72340')
    compile project(':customtabs2340')
    compile project(':heyzap')
    compile project(':oneSignalConfig')
    compile project(':samsungApps')
    compile project(':shortcutBadger115')
    compile project(':unityAds')
    compile project(':vungle')
    compile project(':common')
    compile project(':facebookandroidsdk4170')
    compile project(':facebookandroidwrapper790')
    compile project(':onesignalunity')
    compile project(':playservicesads980')
    compile project(':playservicesadslite980')
    compile project(':playservicesbase980')
    compile project(':playservicesclearcut980')
    compile project(':playservicesgass980')
    compile project(':playservicesgcm980')
    compile project(':playservicesiid980')
    compile project(':playserviceslocation980')
    compile project(':playservicestasks980')
    compile project(':supportcompat2500')
    compile project(':supportcoreui2500')
    compile project(':supportcoreutils2500')
    compile project(':supportfragment2500')
    compile project(':supportmediacompat2500')
    compile project(':supportv42500')
    compile project(':supportvectordrawable2500')
}

Project gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

非常感谢任何建议/参考。感谢。

1 个答案:

答案 0 :(得分:0)

问题在于

END

已包含com.android.support及其所有子项目。 我已删除所有

EVENTTYPE