Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Right now, the maximum is Target API Level 30, but is there Target API Level 31?

Discussion in 'Android' started by hee_human, Apr 14, 2021.

  1. hee_human

    hee_human

    Joined:
    Dec 24, 2019
    Posts:
    1
    Is Target API Level 30 currently available, is this the maximum at the moment, or is there Target API Level 31 ?
    I just saw the Android 12 SDK Build-Tools 31, and wondered if it was possible to connect it to Unity?
    Maybe I got something wrong.

    https://developer.android.com/about/versions/12/setup-sdk
     
  2. kaarloew

    kaarloew

    Joined:
    Nov 1, 2018
    Posts:
    360
    Just keep the target in 30
    "When you upload an app bundle or APK, it needs to meet Google Play’s target API level requirements. By August 2021, new apps must target at least Android 11 (API level 30). By November 2021, all apps that are being updated must target at least Android 11 (API level 30)."
    https://developer.android.com/distribute/play-policies#APILevel30
     
  3. teamamplify

    teamamplify

    Joined:
    Nov 24, 2016
    Posts:
    12
    Is there any estimation about when API Level 31 will be available in Unity?

    How was it handled in the past? Was there a large delay between an Android-Release and Unity supporting it?
     
  4. JonathanFri

    JonathanFri

    Joined:
    Jul 3, 2019
    Posts:
    13
    I usually install newer sdk with android studio and building with Unity works quite good using these newer apis.
    However, api 31 does require Java 11. But Unity needs 1.8 atm. Checked with 2019.4.16 (Could have changed).
    Building against 31 fails due to the java version
     
    sohamxbr likes this.
  5. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    In general once the non release candidate API version is released, Unity editor should automatically pick it up and should allow to target it.
     
  6. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    SDK consists of multiple components - build-tools, platform-tools, platforms (this is the API level). I don't know if API 31 requires Java 11 or not, but there is a possibility that it is only a new version of build-tools that requires Java 11, while API 31 might not have a strict dependency on the new build-tools version. There is a possibility that projects will be able to target API 31 without using Java 11, but this needs to be tested to know for sure.
     
    JonathanFri likes this.
  7. TR1KK

    TR1KK

    Joined:
    Feb 7, 2015
    Posts:
    9
    Hi any update about building for API 31? I still can't build with that API level. I am getting an error everytime i tried to build even on a fresh empty project.
     
  8. Virilic

    Virilic

    Joined:
    May 3, 2021
    Posts:
    4
    Same here, any updates on whether we can build for API 31? I'm using Unity 2020.3.18f.
     
  9. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    If you get errors building for API level 31, please paste them here. There are issues with build-tools version 31, but they should not prevent apps from targeting API level 31.
     
  10. votagus

    votagus

    Joined:
    Dec 13, 2016
    Posts:
    15
    I can't install apks built with target api 31 in android 12 devices, it works fine in versions below.
     
  11. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Ah, so the issue is not about building, but about installing. This is a known issue and it is being fixed https://issuetracker.unity3d.com/is...-android-application-with-target-api-level-31 meanwhile you can workaround it by enabling the custom main manifest in player settings and then adding android:exported="true" attribute to the main activity.
     
  12. mvaz_p

    mvaz_p

    Joined:
    Aug 22, 2018
    Posts:
    80
    Hi @JuliusM , I'm trying to build with target SDK 31 and this error is happening:


    Code (CSharp):
    1. CommandInvokationFailure: Gradle build failed.
    2. /Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/bin/java -classpath "/Applications/Unity/Hub/Editor/2020.3.20f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease"
    3.  
    4. stderr[
    5. Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    6. An exception has occurred in the compiler (1.8.0_312). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
    7. java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)
    8.     at com.sun.tools.javac.util.Assert.error(Assert.java:133)
    I've tried manually updating JDK 8 to 11, but Unity (2020.3.20f1) doesn't allow it.
     
  13. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Could you submit a bug report? This doesn't seem to happen with the simple project, so there are some specific steps required to reproduce the issue.
     
  14. stickylab

    stickylab

    Joined:
    Mar 16, 2016
    Posts:
    92

    im fallin love with unity 2017 but there is no api level 11 in the build setttings ,,how to fix it .please
     
  15. Alex-Some

    Alex-Some

    Joined:
    Oct 30, 2013
    Posts:
    15
    @JuliusM we use Unity Editor 2021.1.28f to build project
    And when we try to install our apk targeting API 31 to Pixel3a mobile phone we still get the manifest error:

    adb: failed to install Test.apk: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl1734724982.tmp/base.apk (at Binary XML file line #219): com.unity.androidnotifications.UnityNotificationRestartOnBootReceiver: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]


    What can we do to fix that error?
     
  16. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,952
    Can you try this and let me know if it works for you - until they update the package?
     
    Last edited: Jan 25, 2022
  17. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    We are working on the notifications package update which will fix this issue.
     
    Adnimistrator likes this.
  18. Mask2007

    Mask2007

    Joined:
    Aug 7, 2014
    Posts:
    8
    Were you able to fix this error?
     
  19. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835