Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Bug Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.

Discussion in 'Editor & General Support' started by Shefich, Apr 26, 2024.

  1. Shefich

    Shefich

    Joined:
    May 23, 2013
    Posts:
    149
    Everytime I get this error upon build:
    "Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'. See the Console for details."

    Unity 2021.3.37 and other versions of 2021. Target API Level 34.

    Stacktrace:
    Code (CSharp):
    1. Note: E:\proj\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.
    2. Note: Recompile with -Xlint:deprecation for details.
    3. ERROR:: D8: com.android.tools.r8.kotlin.H
    4.  
    5. FAILURE: Build completed with 3 failures.
    6.  
    7. 1: Task failed with an exception.
    8. -----------
    9. * What went wrong:
    10. Execution failed for task ':launcher:mergeExtDexRelease'.
    11. > Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.
    12.    > Failed to transform play-services-measurement-api-21.5.1.aar (com.google.android.gms:play-services-measurement-api:21.5.1) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-incremental-transform=true, dexing-is-debuggable=false, dexing-min-sdk=22, org.gradle.status=release, org.gradle.usage=java-runtime}.
    13.       > Execution failed for DexingWithClasspathTransform: C:\Users\user\.gradle\caches\transforms-2\files-2.1\0a90e66ff9319bf31d2d761c3485ef0c\jetified-play-services-measurement-api-21.5.1-runtime.jar.
    14.          > Error while dexing.
    15.  
    16. * Try:
    17. 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.
    18. ==============================================================================
    19.  
    20. 2: Task failed with an exception.
    21. -----------
    22. * What went wrong:
    23. Execution failed for task ':launcher:bundleReleaseResources'.
    24. > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable
    25.    > AAPT2 aapt2-4.2.2-7147631-windows Daemon #0: Unexpected error during link, attempting to stop daemon.
    26.      This should not happen under normal circumstances, please file an issue if it does.
    27.  
    28. * Try:
    29. 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.
    30. ==============================================================================
    31.  
    32. 3: Task failed with an exception.
    33. -----------
    34. * What went wrong:
    35. Execution failed for task ':launcher:processReleaseResources'.
    36. > A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
    37.    > AAPT2 aapt2-4.2.2-7147631-windows Daemon #1: Unexpected error during link, attempting to stop daemon.
    38.      This should not happen under normal circumstances, please file an issue if it does.
    39.  
    40. * Try:
    41. 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.
    42. ==============================================================================
    43.  
    44. * Get more help at https://help.gradle.org
    45.  
    46. BUILD FAILED in 20s
    47. Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    48.  
    49. UnityEditor.GenericMenu:CatchMenu (object,string[],int)

    Builds successfully if the target API level is 33. So can't build for level 34.
    Also unity 2022 versions with target API level is 34 build successfully.

    I tried to double check passwords for project keystore, check/uncheck preferences/External Tools, reimported all, force resolve Android libraries, relaunch unity, etc. nothing works.
    Also I have custom Main Manifest, Main Gradle Template, Launcher Gradle Template, Base Gradle Template, Gradle Properties Template. No Minify selected. Multidex enabled.

    How can I build for level 34 on unity 2021.3.37?
     
  2. joycatdev

    joycatdev

    Joined:
    Aug 20, 2021
    Posts:
    8
    did you find a fix? having same problem
     
  3. Shefich

    Shefich

    Joined:
    May 23, 2013
    Posts:
    149
    I am building now with unity 2022.3.x.
    Tried to build with unity 2021.3.38 - build happens. In some version they added something to be sure the build for API 34 happens normally. You can check release notes.
    If the issue still exist, try to update all the SDKs in your project. Also you can try to copy folders for Android SDK Tools, gradle, NDK, OpenJDK to another location (like C://...) and use that location for External tools.
     
  4. LybNik

    LybNik

    Joined:
    Oct 17, 2022
    Posts:
    4
    Guys, do you know how to fix this error?

    * What went wrong:
    Execution failed for task ':launcher:checkReleaseAarMetadata'.
    > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
    > The minCompileSdk (34) specified in a
    dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
    is greater than this module's compileSdkVersion (android-33).
    Dependency: androidx.media3:media3-extractor:1.2.1.
    AAR metadata file: C:\Users\Администратор\.gradle\caches\transforms-2\files-2.1\5b4b38751b389168237b92cbd884462f\jetified-media3-extractor-1.2.1\META-INF\com\android\build\gradle\aar-metadata.properties.

    I just don't know where I can change version to 33 for this thing, because if I change file mentioned in the error, it will change back while building and show me error again
     
  5. thunguyen177

    thunguyen177

    Joined:
    Aug 11, 2020
    Posts:
    3
  6. joycatdev

    joycatdev

    Joined:
    Aug 20, 2021
    Posts:
    8
    fixed by adding modfying and writing this number ==> "com.android.tools.build:gradle:4.2.0" in my "baseProjectTemplate"


    here how it should be ===>


    ------------------------------------------------------------------------------------------------------------------------------------------------------


    allprojects {
    buildscript {
    repositories {**ARTIFACTORYREPOSITORY**
    google()
    jcenter()
    }
    dependencies {
    // If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity
    // See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html
    // See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
    // To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version
    classpath 'com.android.tools.build:gradle:4.2.0'
    **BUILD_SCRIPT_DEPS**
    }
    }
    repositories {**ARTIFACTORYREPOSITORY**
    google()
    jcenter()
    flatDir {
    dirs "${project(':unityLibrary').projectDir}/libs"
    }
    }
    }
    task clean(type: Delete) {
    delete rootProject.buildDir
    }

    ----------------------------------------------------------------------------------------------------------------------------------