Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

gradle build fail with adressables

Discussion in 'Android' started by Ekibyo_Kaim, Sep 24, 2020.

  1. Ekibyo_Kaim

    Ekibyo_Kaim

    Joined:
    Mar 5, 2015
    Posts:
    11
    I'm having a huge issue. I simply can't build my game anymore on Android. It says there is an error with AAPT2 but it doesn't make much sense to me. And it seems it manage to make the build if the addressables build it empty.

    This is quite important for me since I have to ship my game in 6 days !

    Anybody knows what the hell could be happening?

    i forgot to say, I'm working on 2020.1.6
    And exporting the project to android Studio doesn't work either.

     
  2. Ekibyo_Kaim

    Ekibyo_Kaim

    Joined:
    Mar 5, 2015
    Posts:
    11
    ok, after a lot of tries, it seems the build crashes if there are too many bundles in the streaming assets folder...
    I had to pack the bundles to "pack together" or "by label" to make it work.
    The problem is that now, the ingame loadings are super slow, and the RAM used is much higher. So I now expect the game to crash on low-end devices... :(
     
    matheus_unity812 likes this.
  3. jorge_acm

    jorge_acm

    Joined:
    Dec 12, 2020
    Posts:
    6
    I have the same problem, but everything happens when I put GoogleMobileAds, (well, it also happens when I put vuforia, but I already solved that) apparently it is more difficult to compile in UNITY than to carry out the same project itself. I am not a programmer, but with all the Unity errors, apparently that I am a simple novice who only knows how to put "Hello world" I solve or try to solve the Unity problems.
     
  4. a-chambriat

    a-chambriat

    Joined:
    Apr 27, 2014
    Posts:
    26
    hello, is there a workaround now ?
     
    anycolourulike likes this.
  5. a-chambriat

    a-chambriat

    Joined:
    Apr 27, 2014
    Posts:
    26
  6. jerry_tianzhizhi

    jerry_tianzhizhi

    Joined:
    Sep 18, 2020
    Posts:
    1
    This is a compatible bug between com.android.tools.build:gradle:3.6.0 and unity 2020, Please do following step to resolve:

    1, Edit -> Player Setting -> Publishing Settings, click "Custom Base Gradle Template" blew the Build section.

    2, You will find a "Assets\Plugins\Android\baseProjectTemplate.gradle" file was generated, open it by text editor.

    3, change
    "classpath 'com.android.tools.build:gradle:3.6.0'"
    into
    "classpath 'com.android.tools.build:gradle:3.4.0'"

    Build again, and don't forget to add it to your CVS.

    If you get solved and like this solution, please do me a favor to mark a star for this repo:
    https://github.com/yasio/yasio

    This repo's author find this solution and he told me.
     
  7. ilixotek

    ilixotek

    Joined:
    Sep 1, 2018
    Posts:
    7
    I had a similar issue when builds started failing after integrating GoogleMobileAds and came across this thread. Solved it by enabling Custom Gradle Properties in Publishing Settings, and adding android.useAndroidX=true and android.enableJetifier=true to the settings file. Also enabled JetBrains via the External Dependency Manager -> Android Resolver -> Settings but that didn't work on its own without the properties file change
     
  8. tairq-ozitech

    tairq-ozitech

    Joined:
    Apr 19, 2016
    Posts:
    1
  9. khanhabib

    khanhabib

    Joined:
    Oct 11, 2018
    Posts:
    29
    i am still facing in unity 2020.2.7 with grale 5.6.4

    the option 'android.enableR8' is deprecated and should not be used anymore. It will be removed in a future version of the Android Gradle plugin, and will no longer allow you to disable R8
     
  10. burak11581999

    burak11581999

    Joined:
    May 4, 2020
    Posts:
    4
    Set to minimum API level to at least 21. It worked for me.
     
  11. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    On Unity 2020.3.19 I've got the minimum api set to 23 and I'm getting this error.
     
    khanhabib likes this.
  12. Wasp3r

    Wasp3r

    Joined:
    Dec 6, 2020
    Posts:
    7
    Same thing, 2020.3.7 and minimum API set to 23
     
    khanhabib likes this.
  13. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    Changing both the minimum and target API's to level 29 (which I believe is what's installed on my Quest 2, for which this build is intended) -- I would get the following error:
    With Publish Settings>>Minify>>Use R8 unticked, I got this error:
    If it was ticked, I got this error:
    So, ticking the box is deprecated and not ticking the box is deprecated??!

    I reinstalled Android SDK 12 (API 31) despite not even targeting that api, yet the build would still fail with multiple complaints about it being corrupted. For whatever reason, the dx.bat file was missing from that API installation, as the above error messages say. So, I fabricated it based on the d8.bat file -- making the couple of changes that are different between the d8.bat and dx.bat in other API installations.
    Since the dx.jar file is also missing the build will still fail...
    No idea why Android Studio isn't installing the dx.jar and dx.bat files for this particular api. Searching the internet I found somebody solved this by copying the dx.dar file from their API 30 installation, which I then tried.
    ...and it worked!

    :D
     
  14. mdeenu928

    mdeenu928

    Joined:
    Dec 11, 2019
    Posts:
    1


    Hey!! Thnx for the Solution......it works
     
  15. Petkopetko

    Petkopetko

    Joined:
    Feb 21, 2018
    Posts:
    2
    Hello!

    In case there is somebody with this problem and mentioned solution did not work for him, I had a similar error during android build using 2020.3.26 and in my case it was caused by my antivirus blocking some android SDK files for some reason. I am using Avast but you might have the same problem with other antivirus as well.

    I have temporarily disabled my antivirus before build and it built without problem, you can try it as well.