Search Unity

Resolved UnityPlayerActivity.java uses or overrides a deprecated API.

Discussion in 'Android' started by tangyinglin0228, Apr 24, 2020.

  1. tangyinglin0228

    tangyinglin0228

    Joined:
    Apr 23, 2018
    Posts:
    16
    It's my hello world Unity and AR project. It's so hard to build amr64 for Google Play submission using IL2CPP. Are there any chances that we can compile a 64bit bundle using Mono?

    First, it's saying that I was compiling an iOS library which I never called and removed from the package manager. I followed what the post told and use #if Unity_IOS to skip those code.

    And then, it pops the following. I tried to google it but I don't see any similar posts.
    I am new to Unity and I started the project in 2019.3.1f1, and I am using 2019.3.9f1. I having no problem compiling and submitting the iOS version but because I don't know what to do on Android.


    Temp/gradleOut/unityLibrary/src/main/java/com/unity3d/player/UnityPlayerActivity.java uses or overrides a deprecated API.

    UnityEditor.EditorApplication:Internal_CallGlobalEventHandler() (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorApplication.cs:442)
     

    Attached Files:

    • new.txt
      File size:
      81.4 KB
      Views:
      878
    Last edited: Apr 24, 2020
  2. tangyinglin0228

    tangyinglin0228

    Joined:
    Apr 23, 2018
    Posts:
    16
    Update: I searched for another error and someone suggested that removing the Ads plugin. And finally it's working now.
     
  3. DungDajHjep

    DungDajHjep

    Joined:
    Mar 25, 2015
    Posts:
    202
    https://github.com/facebook/facebook-sdk-for-unity/issues/386
    https://forum.unity.com/threads/cant-build-with-multidex-enabled.773348/


    For anyone looking for solution.
    You have to move your
    implementation 'androidx.multidex:multidex:2.0.1'
    and
    multiDexEnabled true
    from mainTemplate.gradle to launcherTemplate.gradle and it should work.

    You should activate these files first here in the Project Setting->Player->Publishing Settings


    I solved it in two steps for Unity 2019.3.11f1:

    1. Go to Edit->Project Settings->Player->Publishing settings->Tick Custom Properties Gradle Template
    2. Go to the newly generated gradleTemplate.properties and add these lines to the top:
    android.useAndroidX=true
    android.enableJetifier=true
     
  4. wolfomat

    wolfomat

    Joined:
    Oct 19, 2014
    Posts:
    24
    hey - this did not work for me :(
    using unity 2019.4.5f1
     
  5. abhi6163

    abhi6163

    Joined:
    May 1, 2014
    Posts:
    3
    if your game has unity ads go to ads service in advance just uncheck the built in ads extensions.
     
    Thoma1207 likes this.
  6. acartayfun1

    acartayfun1

    Joined:
    Dec 22, 2017
    Posts:
    8
    unity Ads unchecked and thats works, Thanks
     
  7. pihels

    pihels

    Joined:
    May 13, 2018
    Posts:
    8
    Had the same error message on building recently and it appeared to be caused by not having enough disk space on my windows partition. So if these fixes don't work you might want to check your available disk capacity.
     
    ladismad likes this.
  8. White_Wabbit

    White_Wabbit

    Joined:
    Aug 16, 2019
    Posts:
    11
    I don't have unity ads
     
    oxalis22 likes this.
  9. Scattered_Gaming_Studio

    Scattered_Gaming_Studio

    Joined:
    Apr 29, 2020
    Posts:
    1
    DungDajHjep, post: 5975267, member: 804466"]https://github.com/facebook/facebook-sdk-for-unity/issues/386
    https://forum.unity.com/threads/cant-build-with-multidex-enabled.773348/


    For anyone looking for solution.
    You have to move your
    implementation 'androidx.multidex:multidex:2.0.1'
    and
    multiDexEnabled true
    from mainTemplate.gradle to launcherTemplate.gradle and it should work.

    You should activate these files first here in the Project Setting->Player->Publishing Settings


    [QUOTE="I solved it in two steps for Unity 2019.3.11f1:

    1. Go to Edit->Project Settings->Player->Publishing settings->Tick Custom Properties Gradle Template
    2. Go to the newly generated gradleTemplate.properties and add these lines to the top:
    android.useAndroidX=true
    android.enableJetifier=true[/QUOTE]

    This worked for me...Thank you
     
    khiemngs likes this.
  10. unnanego

    unnanego

    Joined:
    May 8, 2018
    Posts:
    199
    hm, on latest 20.1 builds ok, but AR starts to work slow as hell and all jittery and on 2019.4.16 getting this error and I don't have ads. I had firebase in the project, but I removed everything and reimported the project, nothing helps. iOS also builds fine
     
  11. EdgarasArt

    EdgarasArt

    Joined:
    May 21, 2015
    Posts:
    11
    Any luck solving it?
     
  12. gamestrigge

    gamestrigge

    Joined:
    Jun 5, 2017
    Posts:
    1
     
  13. fathiridaa

    fathiridaa

    Joined:
    Oct 18, 2020
    Posts:
    1
    I had the same problem anyway, is there anyone who solved it?
     
  14. EyeDev44

    EyeDev44

    Joined:
    Apr 8, 2017
    Posts:
    149
  15. santosh810666

    santosh810666

    Joined:
    Sep 18, 2012
    Posts:
    5
    instead of ar core i install ar foundation for my case
     
  16. adrianccee

    adrianccee

    Joined:
    May 10, 2020
    Posts:
    1
    The same. Please help!
     
  17. Personuo

    Personuo

    Joined:
    Mar 19, 2014
    Posts:
    129
    unity 2020 brings me too many problems, crashing, packing failure

    This problem I had in version 2020.2, after 3 days of numerous attempts, I solved him because I changed too many things, I do not know how I solved it
    Now this problem is back in 2020.3

    I create a new project, add admob and googleplay, it's packable, but not in my project, I don't know where the conflict is
     
  18. ajith_sreenivasan

    ajith_sreenivasan

    Joined:
    Aug 29, 2018
    Posts:
    7
    It works but,
    If I uncheck that option, I get an orange popup: To continue using Unity Ads in your project, please import the latest Unity Ads Plugin from the Asset Store, or re-enable the internal Ads extension under the Advanced settings below.

    Will this stop showing live ads in the game?
     
    sonnch79 likes this.
  19. TibiTibith

    TibiTibith

    Joined:
    Mar 8, 2015
    Posts:
    29
    GODSENT! Thank you, sir! After 3 days of banging my head against a wall, I finally managed to get a build working! Thank you!
     
    SpicyCatGames likes this.
  20. Cippman

    Cippman

    Joined:
    Sep 4, 2014
    Posts:
    12
  21. Slashik

    Slashik

    Joined:
    Jan 26, 2016
    Posts:
    6
    I am here to tell that, a simple restart fixed the issue for me. Using 2020.3.13f1
     
  22. mrchrissross

    mrchrissross

    Joined:
    Jun 20, 2019
    Posts:
    10
    My current version is: 2020.3.17f1.

    Thought I'd post my fix here for those of you who, like me, tried all of the above to no avail. Try to change Minimum API Level to Android 5.0. This resolved my issue immediately.
     
  23. Red_Dragon69

    Red_Dragon69

    Joined:
    Sep 7, 2015
    Posts:
    115
    Another reason for this error may be, when using a custom keystore. Unity displays this error, when no password is provided in Edit->Project Settings->Player->Publishing settings-> Project Keystore and Project Key fields.
     
    WTFusername and dman8723 like this.
  24. DeLannoy04

    DeLannoy04

    Joined:
    Jul 2, 2019
    Posts:
    42
    Ohh man I have been trying to fix this issue for 5 hours now.
    But for me what helped is changing the Min API Level from 5.0 to 7.0
    Thanks :)
     
    atitovdvg likes this.
  25. brl2002

    brl2002

    Joined:
    Jan 11, 2013
    Posts:
    1
    If anyone has this issue and none of the suggestions worked for you, try checking Android SDK installed on your machine, mine had a revision for the API version that I was targeting so it said it was partially installed which I think might have been the reason my builds were failing for Android. After updating the builds worked again.
     
  26. Xertz-Games

    Xertz-Games

    Joined:
    Aug 8, 2015
    Posts:
    1
    UnityPlayerActivity.java uses or overrides a deprecated API

    If anyone has this issue and using unity mediation with admob then go to services off ads and uinstall the advertisement from package manager because UnityAdsUnityAdapter for admob auto install the unity sdk. :cool:
     
    Last edited: Apr 22, 2022
    Arthur-St and mohamedbk like this.
  27. starikcetin

    starikcetin

    Joined:
    Dec 7, 2017
    Posts:
    340
    I had to change my target API level to 33 in order to fix this issue.
     
    ZeroDanger likes this.
  28. zeryabahmed67

    zeryabahmed67

    Joined:
    Jan 22, 2021
    Posts:
    3

    This Work for me ! Thanks
     
  29. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    191
    I had same problem, it was because I did not have a project keystore created/used.

    2021.3.16f1
     
  30. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    185
    I had to update to latest Unity version LTS (in my case Unity 2021.3.26f1. I believe it's because I used an already newer Unity version in a different game and when going back to an earlier version of Unity with the game that gave me this error it found those deprecated APIs... just a hypothesis though. Gradle is a bitch.
     
  31. Arthur-St

    Arthur-St

    Joined:
    Sep 8, 2015
    Posts:
    1
    YOU ARE A LORD! VERY THANKS! (Unity 2021.3.15f1 and 2022.3.1f1)
     
  32. Narendra_Reddy_137

    Narendra_Reddy_137

    Joined:
    Aug 26, 2021
    Posts:
    2
    upload_2023-7-4_13-20-15.png
    Add these two lines in LauncherTemplate.gradle
    upload_2023-7-4_13-21-23.png
    Add these two lines in GradleTemplate.properties.

    it works for me in 2021.3.8f1
     
    ocularbioengarhku likes this.
  33. AndyDBell

    AndyDBell

    Joined:
    Nov 7, 2018
    Posts:
    2
    v2020.3.45f1

    I got the UnityPlayerActivity.java uses or overrides a deprecated API error appear after I changed my KeyStore password and Unity did not persist it. i.e. Wrong Keystore password.

    Build errors started with:
    Starting a Gradle Daemon, 1 incompatible and 4 stopped Daemons could not be reused, use --status for details
    Note: C:\Users\andyb\Documents\Development\WorkingSpec\Code\model-viewer-app\model-viewer-app\Temp\gradleOut\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    etc


    I blundered around trying to fix until I noticed the bad KeyStore password settings. Updating the passwords fixed the Build problem.

    So, the UnityPlayerActivity.java error seems to be meaningless message after real cause - in my case - not reported.
     
    ggzerosum likes this.
  34. ggzerosum

    ggzerosum

    Joined:
    Sep 26, 2017
    Posts:
    33
    I also encounter this error, same case. Thank you.


    < Future reference >
    Error Message:
    UnityPlayerActivity.java uses or overrides a deprecated API .....

    Solution:
    check if you typed wrong password or not in project keystore password field.
    ProjectSetting -> Player -> Publish Settings -> check password of project keystore