2

I am able to successfully test on my android device via "Build and Run" in Unity 5.3.5. I am able to export the unity project to Android Studio.

However, when I run the android studio project, it gives me numerous errors. The first was solved by adding the following to the .gradle file:

multiDexEnabled true

Now I have come across the problem of:

Error:Execution failed for task ':fishDiver:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/unity/purchasing/amazon/BuildConfig.class

My gradle file is as such:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.sink.fish"
    minSdkVersion 9
    targetSdkVersion 19
    multiDexEnabled true
}

dexOptions {
    javaMaxHeapSize "4g" //specify the heap size for the dex process
}

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

dependencies {
compile project(':amazonAppStore')
compile project(':googleAIDL')
compile project(':googlePlay')
compile project(':common')
compile project(':unityadsrelease')
compile files('libs/unity-classes.jar')
}

Can anyone point me in the right direction?

I have not added anything extra, only the Unity Ads API, Unity IAP API, and the Unity Analytics API.

But other then that it is a pretty basic build and it is not working!

What I have tried:

gradle cleaning: ./gradlew clean

Deleting the build folders,

removing any added plugins for Android within Unity,

Rebuilding and cleaning from within Android Studio

random tweaks here and there

Community
  • 1
  • 1
Julio
  • 483
  • 1
  • 4
  • 17
  • I believe that the unity IAP requires a minSDKVersion of 15... Anyway, your error shows that you have duplicated classes. Make sure that you don't have any duplicated .jars or classes. – Cabrra Jun 17 '16 at 15:50
  • @Cabrra updated the minimum SDK to 15 as a precautionary measure. I understand that the issue may be caused by duplicate classes however, I am unsure how to fix this as these are the default jars being created from exporting out of unity. In fact, I have no plugins included for the android build. – Julio Jun 17 '16 at 18:24
  • I don't like flagging questions... so I won't do it this time. After 5s research I found this: http://stackoverflow.com/questions/33209631/errorexecution-failed-for-task-apptransformclasseswithjarmergingfordebug Is the same issue you have. – Cabrra Jun 17 '16 at 18:41
  • @Cabrra thank you for bringing that up and I apologize for not being clearer. I have already looked at that and it has not helped me. I have looked all over stackoverflow and unity. I believe this is a Unity issue and not as much of an android studio issue. It should just build after exporting and that is not the case. I will update my question to reflect the fact that I have already done preliminary research and tried a bunch of things – Julio Jun 17 '16 at 18:47
  • One quick question. Are you using UnityAds? – Cabrra Jun 17 '16 at 18:51
  • @Cabrra Yes. Unity Ads, Unity Analytics, and Unity In-App Purchases – Julio Jun 17 '16 at 18:54
  • did you check the unity forum? here https://github.com/googleanalytics/google-analytics-plugin-for-unity/issues/51 and https://github.com/playgameservices/play-games-plugin-for-unity/issues/740 The users give various solutions. (I won't steal the merit for it). Let me know. – Cabrra Jun 17 '16 at 19:02

0 Answers0