Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

com.android.build.api.transform.TransformException: Error while generating the main dex list.

Discussion in 'Android' started by BenoitFreslon, Aug 7, 2019.

  1. BenoitFreslon

    BenoitFreslon

    Joined:
    Jan 16, 2013
    Posts:
    136
    Hello,

    I updated some sdk and Unity but I got this error when I try to build an .apk

    Unity 2018.4.5f1

    Min API level : 4.4 (19)
    Target API Level : 9.0 (28)

    Here is my manTemplate.gradle at the bottom

    Code (CSharp):
    1. CommandInvokationFailure: Gradle build failed.
    2. /Applications/Unity/Hub/Editor/2018.4.5f1/PlaybackEngines/AndroidPlayer/Tools/OpenJDK/MacOS/bin/java -classpath "/Applications/Unity/Hub/Editor/2018.4.5f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"
    3.  
    4. stderr[
    5.  
    6. FAILURE: Build failed with an exception.
    7.  
    8. * What went wrong:
    9. Execution failed for task ':transformClassesWithMultidexlistForDebug'.
    10. > com.android.build.api.transform.TransformException: Error while generating the main dex list.
    11.  
    12. * Try:
    13. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    14.  
    15. * Get more help at https://help.gradle.org
    16.  
    17. BUILD FAILED in 29s
    18. ]
    19. stdout[
    20. > Task :checkDebugClasspath
    21. > Task :preBuild UP-TO-DATE
    22. > Task :an_library.bundle:preBuild UP-TO-DATE
    23. > Task :an_library.bundle:preDebugBuild UP-TO-DATE
    24. > Task :an_library.bundle:checkDebugManifest
    25. > Task :an_library.bundle:processDebugManifest
    26. > Task :aup:preBuild UP-TO-DATE
    27. > Task :aup:preDebugBuild UP-TO-DATE
    28. > Task :aup:checkDebugManifest
    29. > Task :aup:processDebugManifest
    30. > Task :GalleryScreenshot:preBuild UP-TO-DATE
    31. > Task :GalleryScreenshot:preDebugBuild UP-TO-DATE
    32. > Task :GalleryScreenshot:checkDebugManifest
    33. > Task :GalleryScreenshot:processDebugManifest
    34. > Task :OneSignalConfig:preBuild UP-TO-DATE
    35. > Task :OneSignalConfig:preDebugBuild UP-TO-DATE
    36. > Task :OneSignalConfig:checkDebugManifest
    37. > Task :OneSignalConfig:processDebugManifest
    38. > Task :unity-android-resources:preBuild UP-TO-DATE
    39. > Task :unity-android-resources:preDebugBuild UP-TO-DATE
    40. > Task :unity-android-resources:checkDebugManifest
    41. > Task :unity-android-resources:processDebugManifest
    42. > Task :preDebugBuild
    43. > Task :an_library.bundle:compileDebugAidl NO-SOURCE
    44. > Task :aup:compileDebugAidl NO-SOURCE
    45. > Task :GalleryScreenshot:compileDebugAidl NO-SOURCE
    46. > Task :OneSignalConfig:compileDebugAidl NO-SOURCE
    47. > Task :unity-android-resources:compileDebugAidl NO-SOURCE
    48. > Task :compileDebugAidl NO-SOURCE
    49. > Task :an_library.bundle:packageDebugRenderscript NO-SOURCE
    50. > Task :aup:packageDebugRenderscript NO-SOURCE
    51. > Task :GalleryScreenshot:packageDebugRenderscript NO-SOURCE
    52. > Task :OneSignalConfig:packageDebugRenderscript NO-SOURCE
    53. > Task :unity-android-resources:packageDebugRenderscript NO-SOURCE
    54. > Task :compileDebugRenderscript UP-TO-DATE
    55. > Task :checkDebugManifest UP-TO-DATE
    56. > Task :generateDebugBuildConfig UP-TO-DATE
    57. > Task :prepareLintJar UP-TO-DATE
    58. > Task :mainApkListPersistenceDebug UP-TO-DATE
    59. > Task :generateDebugResValues UP-TO-DATE
    60. > Task :generateDebugResources UP-TO-DATE
    61. > Task :an_library.bundle:compileDebugRenderscript
    62. > Task :an_library.bundle:generateDebugResValues
    63. > Task :an_library.bundle:generateDebugResources
    64. > Task :an_library.bundle:packageDebugResources
    65. > Task :aup:compileDebugRenderscript
    66. > Task :aup:generateDebugResValues
    67. > Task :aup:generateDebugResources
    68. > Task :aup:packageDebugResources
    69. > Task :GalleryScreenshot:compileDebugRenderscript
    70. > Task :GalleryScreenshot:generateDebugResValues
    71. > Task :GalleryScreenshot:generateDebugResources
    72. > Task :GalleryScreenshot:packageDebugResources
    73. > Task :OneSignalConfig:compileDebugRenderscript
    74. > Task :OneSignalConfig:generateDebugResValues
    75. > Task :OneSignalConfig:generateDebugResources
    76. > Task :OneSignalConfig:packageDebugResources
    77. > Task :unity-android-resources:compileDebugRenderscript
    78. > Task :unity-android-resources:generateDebugResValues
    79. > Task :unity-android-resources:generateDebugResources
    80. > Task :unity-android-resources:packageDebugResources
    81. > Task :mergeDebugResources
    82. > Task :createDebugCompatibleScreenManifests UP-TO-DATE
    83. > Task :processDebugManifest
    84. > Task :splitsDiscoveryTaskDebug UP-TO-DATE
    85. > Task :an_library.bundle:generateDebugRFile
    86. > Task :aup:generateDebugRFile
    87. > Task :GalleryScreenshot:generateDebugRFile
    88. > Task :OneSignalConfig:generateDebugRFile
    89. > Task :unity-android-resources:generateDebugRFile
    90. > Task :processDebugResources
    91. > Task :generateDebugSources
    92. > Task :an_library.bundle:generateDebugBuildConfig
    93. > Task :an_library.bundle:prepareLintJar UP-TO-DATE
    94. > Task :an_library.bundle:generateDebugSources
    95. > Task :an_library.bundle:javaPreCompileDebug
    96. > Task :an_library.bundle:compileDebugJavaWithJavac
    97. > Task :an_library.bundle:processDebugJavaRes NO-SOURCE
    98. > Task :an_library.bundle:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
    99. > Task :aup:generateDebugBuildConfig
    100. > Task :aup:prepareLintJar UP-TO-DATE
    101. > Task :aup:generateDebugSources
    102. > Task :aup:javaPreCompileDebug
    103. > Task :aup:compileDebugJavaWithJavac
    104. > Task :aup:processDebugJavaRes NO-SOURCE
    105. > Task :aup:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
    106. > Task :GalleryScreenshot:generateDebugBuildConfig
    107. > Task :GalleryScreenshot:prepareLintJar UP-TO-DATE
    108. > Task :GalleryScreenshot:generateDebugSources
    109. > Task :GalleryScreenshot:javaPreCompileDebug
    110. > Task :GalleryScreenshot:compileDebugJavaWithJavac
    111. > Task :GalleryScreenshot:processDebugJavaRes NO-SOURCE
    112. > Task :GalleryScreenshot:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
    113. > Task :OneSignalConfig:generateDebugBuildConfig
    114. > Task :OneSignalConfig:prepareLintJar UP-TO-DATE
    115. > Task :OneSignalConfig:generateDebugSources
    116. > Task :OneSignalConfig:javaPreCompileDebug
    117. > Task :OneSignalConfig:compileDebugJavaWithJavac
    118. > Task :OneSignalConfig:processDebugJavaRes NO-SOURCE
    119. > Task :OneSignalConfig:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
    120. > Task :unity-android-resources:generateDebugBuildConfig
    121. > Task :unity-android-resources:prepareLintJar UP-TO-DATE
    122. > Task :unity-android-resources:generateDebugSources
    123. > Task :unity-android-resources:javaPreCompileDebug
    124. > Task :unity-android-resources:compileDebugJavaWithJavac
    125. > Task :unity-android-resources:processDebugJavaRes NO-SOURCE
    126. > Task :unity-android-resources:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
    127. > Task :javaPreCompileDebug
    128. > Task :compileDebugJavaWithJavac
    129. > Task :compileDebugNdk NO-SOURCE
    130. > Task :compileDebugSources
    131. > Task :mergeDebugShaders UP-TO-DATE
    132. > Task :compileDebugShaders UP-TO-DATE
    133. > Task :generateDebugAssets UP-TO-DATE
    134. > Task :an_library.bundle:mergeDebugShaders
    135. > Task :an_library.bundle:compileDebugShaders
    136. > Task :an_library.bundle:generateDebugAssets
    137. > Task :an_library.bundle:packageDebugAssets
    138. > Task :aup:mergeDebugShaders
    139. > Task :aup:compileDebugShaders
    140. > Task :aup:generateDebugAssets
    141. > Task :aup:packageDebugAssets
    142. > Task :GalleryScreenshot:mergeDebugShaders
    143. > Task :GalleryScreenshot:compileDebugShaders
    144. > Task :GalleryScreenshot:generateDebugAssets
    145. > Task :GalleryScreenshot:packageDebugAssets
    146. > Task :OneSignalConfig:mergeDebugShaders
    147. > Task :OneSignalConfig:compileDebugShaders
    148. > Task :OneSignalConfig:generateDebugAssets
    149. > Task :OneSignalConfig:packageDebugAssets
    150. > Task :unity-android-resources:mergeDebugShaders
    151. > Task :unity-android-resources:compileDebugShaders
    152. > Task :unity-android-resources:generateDebugAssets
    153. > Task :unity-android-resources:packageDebugAssets
    154. > Task :mergeDebugAssets
    155. /Users/Benoit/Workshop/Projets/EnigmBox-Unity-2018.3/Temp/gradleOut/libs/an_licensing_library.jar: D8: Type `org.apache.http.client.utils.URLEncodedUtils` was not found, it is required for default or static interface methods desugaring of `java.util.Map com.google.android.vending.licensing.ServerManagedPolicy.decodeExtras(java.lang.String)`
    156. /Users/Benoit/Workshop/Projets/EnigmBox-Unity-2018.3/Temp/gradleOut/libs/an_licensing_library.jar: D8: Type `org.apache.http.client.utils.URLEncodedUtils` was not found, it is required for default or static interface methods desugaring of `java.util.Map com.google.android.vending.licensing.APKExpansionPolicy.decodeExtras(java.lang.String)`
    157. /Users/Benoit/Workshop/Projets/EnigmBox-Unity-2018.3/Temp/gradleOut/libs/twitter4j-core-4.0.4.jar: D8: Type `org.apache.commons.logging.LogFactory` was not found, it is required for default or static interface methods desugaring of `twitter4j.Logger twitter4j.CommonsLoggingLoggerFactory.getLogger(java.lang.Class)`
    158. /Users/Benoit/Workshop/Projets/EnigmBox-Unity-2018.3/Temp/gradleOut/libs/twitter4j-core-4.0.4.jar: D8: Type `java.lang.management.ManagementFactory` was not found, it is required for default or static interface methods desugaring of `void twitter4j.TwitterAPIMonitor.<clinit>()`
    159. /Users/Benoit/Workshop/Projets/EnigmBox-Unity-2018.3/Temp/gradleOut/libs/twitter4j-core-4.0.4.jar: D8: Type `org.apache.log4j.Logger` was not found, it is required for default or static interface methods desugaring of `twitter4j.Logger twitter4j.Log4JLoggerFactory.getLogger(java.lang.Class)`
    160. /Users/Benoit/Workshop/Projets/EnigmBox-Unity-2018.3/Temp/gradleOut/libs/twitter4j-core-4.0.4.jar: D8: Type `org.slf4j.LoggerFactory` was not found, it is required for default or static interface methods desugaring of `twitter4j.Logger twitter4j.SLF4JLoggerFactory.getLogger(java.lang.Class)`
    161. /Users/Benoit/Workshop/Projets/EnigmBox-Unity-2018.3/Temp/gradleOut/libs/twitter4j-core-4.0.4.jar: D8: Interface `javax.management.DynamicMBean` not found. It's needed to make sure desugaring of `twitter4j.management.APIStatisticsOpenMBean` is correct. Desugaring will assume that this interface has no default method.
    162. /Users/Benoit/.gradle/caches/transforms-2/files-2.1/296e2fd28f70e382d74372500ea50154/jars/classes.jar: D8: Type `com.google.android.gms.gcm.GoogleCloudMessaging` was not found, it is required for default or static interface methods desugaring of `java.lang.String com.onesignal.PushRegistratorGCM.getToken(java.lang.String)`
    163. /Users/Benoit/.gradle/caches/transforms-2/files-2.1/296e2fd28f70e382d74372500ea50154/jars/classes.jar: D8: Type `com.google.firebase.FirebaseApp` was not found, it is required for default or static interface methods desugaring of `void com.onesignal.PushRegistratorFCM.initFirebaseApp(java.lang.String)`
    164. /Users/Benoit/.gradle/caches/transforms-2/files-2.1/296e2fd28f70e382d74372500ea50154/jars/classes.jar: D8: Type `com.google.firebase.iid.FirebaseInstanceId` was not found, it is required for default or static interface methods desugaring of `java.lang.String com.onesignal.PushRegistratorFCM.getToken(java.lang.String)`
    165. /Users/Benoit/.gradle/caches/transforms-2/files-2.1/296e2fd28f70e382d74372500ea50154/jars/classes.jar: D8: Type `com.amazon.device.iap.model.ProductDataResponse$RequestStatus` was not found, it is required for default or static interface methods desugaring of `void com.onesignal.TrackAmazonPurchase$1.<clinit>()`
    166. /Users/Benoit/.gradle/caches/transforms-2/files-2.1/296e2fd28f70e382d74372500ea50154/jars/classes.jar: D8: Type `com.amazon.device.iap.PurchasingService` was not found, it is required for default or static interface methods desugaring of `void com.onesignal.TrackAmazonPurchase$OSPurchasingListener.onPurchaseResponse(com.amazon.device.iap.model.PurchaseResponse)`
    167. /Users/Benoit/.gradle/caches/transforms-2/files-2.1/296e2fd28f70e382d74372500ea50154/jars/classes.jar: D8: Interface `com.amazon.device.iap.PurchasingListener` not found. It's needed to make sure desugaring of `com.onesignal.TrackAmazonPurchase$OSPurchasingListener` is correct. Desugaring will assume that this interface has no default method.
    168. /Users/Benoit/Workshop/Projets/EnigmBox-Unity-2018.3/Temp/gradleOut/aup/libs/AUP.jar: D8: Type `com.google.android.gms.ads.identifier.AdvertisingIdClient` was not found, it is required for default or static interface methods desugaring of `void com.gigadrillgames.androidplugin.deviceinfo.DeviceInfoController.extracAdvertisingId()`
    169. /Users/Benoit/.gradle/caches/transforms-2/files-2.1/296e2fd28f70e382d74372500ea50154/jars/classes.jar: D8: Type `com.google.android.gms.location.LocationRequest` was not found, it is required for default or static interface methods desugaring of `void com.onesignal.LocationGMS$LocationUpdateListener.<init>(com.google.android.gms.common.api.GoogleApiClient)`
    170. /Users/Benoit/.gradle/caches/transforms-2/files-2.1/296e2fd28f70e382d74372500ea50154/jars/classes.jar: D8: Type `com.google.android.gms.ads.identifier.AdvertisingIdClient` was not found, it is required for default or static interface methods desugaring of `java.lang.String com.onesignal.AdvertisingIdProviderGPS.getIdentifier(android.content.Context)`
    171. /Users/Benoit/.gradle/caches/transforms-2/files-2.1/296e2fd28f70e382d74372500ea50154/jars/classes.jar: D8: Type `com.amazon.device.iap.PurchasingService` was not found, it is required for default or static interface methods desugaring of `void com.onesignal.TrackAmazonPurchase.setListener()`
    172. /Users/Benoit/.gradle/caches/transforms-2/files-2.1/296e2fd28f70e382d74372500ea50154/jars/classes.jar: D8: Interface `com.google.android.gms.location.LocationListener` not found. It's needed to make sure desugaring of `com.onesignal.LocationGMS$LocationUpdateListener` is correct. Desugaring will assume that this interface has no default method.
    173. /Users/Benoit/Workshop/Projets/EnigmBox-Unity-2018.3/Temp/gradleOut/aup/libs/AUP.jar: D8: Type `com.nostra13.universalimageloader.core.ImageLoader` was not found, it is required for default or static interface methods desugaring of `void com.gigadrillgames.androidplugin.image.ImageCustomActivity.<init>()`
    174. > Task :transformClassesWithDexBuilderForDebug
    175. > Task :transformClassesWithMultidexlistForDebug FAILED
    176.  
    177. Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
    178. Use '--warning-mode all' to show the individual deprecation warnings.
    179. See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
    180. 90 actionable tasks: 75 executed, 15 up-to-date
    181. ]
    182. exit code: 1
    183. UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <62f761e6ab1445a38cdcb4ac36512695>:0)
    184. UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <62f761e6ab1445a38cdcb4ac36512695>:0)
    185. UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <62f761e6ab1445a38cdcb4ac36512695>:0)
    186. UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <62f761e6ab1445a38cdcb4ac36512695>:0)
    187. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <62f761e6ab1445a38cdcb4ac36512695>:0)
    188. Rethrow as GradleInvokationException: Gradle build failed
    189. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <62f761e6ab1445a38cdcb4ac36512695>:0)
    190. UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <62f761e6ab1445a38cdcb4ac36512695>:0)
    191. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <62f761e6ab1445a38cdcb4ac36512695>:0)
    192. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    193.  
    mainTemplate.gradle

    Code (CSharp):
    1. buildscript {
    2.     repositories {
    3.         jcenter()
    4.         google()
    5.     }
    6.  
    7.     dependencies {
    8.         classpath 'com.android.tools.build:gradle:3.2.0'
    9. **BUILD_SCRIPT_DEPS**}
    10. }
    11.  
    12. allprojects {
    13.     repositories {
    14.         google()
    15.         jcenter()
    16.         flatDir {
    17.             dirs 'libs'
    18.         }
    19.     }
    20. }
    21.  
    22. apply plugin: 'com.android.application'
    23. **APPLY_PLUGINS**
    24.  
    25. dependencies {
    26.     implementation 'com.android.support:multidex:1+'
    27.     implementation fileTree(dir: 'libs', include: ['*.jar'])
    28. **DEPS**}
    29.  
    30. android {
    31.     compileSdkVersion **APIVERSION**
    32.     buildToolsVersion '**BUILDTOOLS**'
    33.  
    34.     compileOptions {
    35.         sourceCompatibility JavaVersion.VERSION_1_8
    36.         targetCompatibility JavaVersion.VERSION_1_8
    37.     }
    38.  
    39.     defaultConfig {
    40.         multiDexEnabled true
    41.         minSdkVersion    **MINSDKVERSION**
    42.         targetSdkVersion **TARGETSDKVERSION**
    43.         applicationId '**APPLICATIONID**'
    44.         ndk {
    45.             abiFilters **ABIFILTERS**
    46.         }
    47.         versionCode **VERSIONCODE**
    48.         versionName '**VERSIONNAME**'
    49.     }
    50.  
    51.     lintOptions {
    52.         abortOnError false
    53.     }
    54.  
    55.     aaptOptions {
    56.         noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
    57.     }**SIGN**
    58.  
    59.     buildTypes {
    60.         debug {
    61.             minifyEnabled **MINIFY_DEBUG**
    62.             //useProguard **PROGUARD_DEBUG**
    63.             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
    64.             jniDebuggable true
    65.         }
    66.         release {
    67.             minifyEnabled **MINIFY_RELEASE**
    68.             //useProguard **PROGUARD_RELEASE**
    69.             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
    70.             **SIGNCONFIG**
    71.         }
    72.     }
    73.     bundle {
    74.         language {
    75.             enableSplit = false
    76.         }
    77.         density {
    78.             enableSplit = false
    79.         }
    80.         abi {
    81.             enableSplit = true
    82.         }
    83.     }
    84. **PACKAGING_OPTIONS**
    85. }
    86.  
    87.  
    88. **SOURCE_BUILD_SETUP**
    89.  
     
  2. djcomy

    djcomy

    Joined:
    Nov 9, 2017
    Posts:
    1
    Did You fix this?
     
  3. dominykasm

    dominykasm

    Unity Technologies

    Joined:
    May 27, 2018
    Posts:
    51
    Hey, that version of Unity is using a newer version of Gradle so the Android Gradle Plugin version 3.4 should be used here: com.android.tools.build:gradle:3.2.0'