Search Unity

Android api 29

Discussion in 'Scripting' started by peterbrinson, Jul 31, 2020.

  1. peterbrinson

    peterbrinson

    Joined:
    Jul 1, 2013
    Posts:
    63
    Sorry for reposting this from the Android forums (5 days ago), but I believe this is important to many?
    ----------------------------------
    Google Play Console consistently warns me about after uploading android builds.

    From August 2020, new apps must target at least Android 10 (API level 29).
    From November 2020, app updates must target Android 10 (API level 29).


    So in Unity Player Settings>Other Settings>Identification, I changed "Target API Level" to 29.

    When I build to Android, I get this warning:



    Updating fails, and it tells me "Please run the SDK Manager manually to make sure you have the latest set of tools and the required platforms installed."

    So in Android Studio, it updated to version 4.0.
    Then I open up SDK Manager and see this:




    Doesn't it look like I have API Level 29?

    I've restarted the computer and tried a few times but I always get this result.

    Thank you.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    Unity 2019 onwards offers to install a copy of the SDK/NDK at install time. This is NOT the copy that you are changing with Android Studio. To see what it is, go into options/preferences in Unity and look for the external tools Android SDK path. That's the one Unity is actually using.
     
  3. peterbrinson

    peterbrinson

    Joined:
    Jul 1, 2013
    Posts:
    63
    Ah. I see a folder, 'android-28'. How do I get 29 in there? Update Unity? I'm only on 2019.3
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    Point Unity away over to where you put the 29 SDK with Android Studio. You might need to not redirect the NDK though, not sure how picky Unity is about that.
     
  5. peterbrinson

    peterbrinson

    Joined:
    Jul 1, 2013
    Posts:
    63
    Very promising. Thank you.

    When I point to here, I get:
    Code (CSharp):
    1. C:\Users\[user]\AppData\Local\Android\Sdk\
    "SDK Tools version 0.0 < 26.1.1"
    ...when I try to build
     
  6. peterbrinson

    peterbrinson

    Joined:
    Jul 1, 2013
    Posts:
    63
    I built a dummy project in 2020.1 and it worked. That's promising but until I update my big project and test, I'm not certain that this is the solution.
     
  7. peterbrinson

    peterbrinson

    Joined:
    Jul 1, 2013
    Posts:
    63
    It looks like the solution is to update Unity. I went from 2019.3 to 2020.1.
     
  8. errisgames

    errisgames

    Joined:
    Aug 2, 2020
    Posts:
    1
    Yes it works. But I would like to use API 29 in version 2019.4.6f1. I copied the android-29 folder and it worked. but now it gives me this error:
    NullReferenceException: Object reference not set to an instance of an object
    GooglePlayServices.UnityCompat.VersionFromAndroidSDKVersionsEnum (System.String enumName, System.String fallbackPrefKey, System.Int32 fallbackValue) (at /Users/smiles/dev/src/unity-jar-resolver/source/PlayServicesResolver/src/UnityCompat.cs:58)
    GooglePlayServices.UnityCompat.GetAndroidTargetSDKVersion () (at /Users/smiles/dev/src/unity-jar-resolver/source/PlayServicesResolver/src/UnityCompat.cs:116)
    GooglePlayServices.PlayServicesResolver.CanEnableJetifierOrPromptUser (System.String titlePrefix) (at /Users/smiles/dev/src/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:2314)
    GooglePlayServices.PlayServicesResolver.ResolveUnsafe (System.Action`1[T] resolutionComplete, System.Boolean forceResolution, System.Boolean isAutoResolveJob, System.Boolean closeWindowOnCompletion) (at /Users/smiles/dev/src/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1635)
    GooglePlayServices.PlayServicesResolver+<ScheduleResolve>c__AnonStorey1E.<>m__3F () (at /Users/smiles/dev/src/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1604)
    GooglePlayServices.PlayServicesResolver.ExecuteNextResolveJob () (at /Users/smiles/dev/src/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1461)
    GooglePlayServices.PlayServicesResolver.ScheduleResolve (System.Boolean forceResolution, System.Boolean closeWindowOnCompletion, System.Action`1[T] resolutionCompleteWithResult, System.Boolean isAutoResolveJob) (at /Users/smiles/dev/src/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1617)
    GooglePlayServices.PlayServicesResolver.ResolveSync (System.Boolean forceResolution, System.Boolean closeWindowOnCompletion) (at /Users/smiles/dev/src/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1514)
    GooglePlayServices.PlayServicesResolver.OnPostProcessScene () (at /Users/smiles/dev/src/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1087)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <fb001e01371b4adca20013e0ac763896>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <fb001e01371b4adca20013e0ac763896>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <fb001e01371b4adca20013e0ac763896>:0)
    UnityEditor.Build.BuildPipelineInterfaces+AttributeCallbackWrapper.OnProcessScene (UnityEngine.SceneManagement.Scene scene, UnityEditor.Build.Reporting.BuildReport report) (at <47ddc45fb441488ba3df69fab6753def>:0)
    UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass16_0.<OnSceneProcess>b__1 (UnityEditor.Build.IProcessSceneWithReport spp) (at <47ddc45fb441488ba3df69fab6753def>:0)
    UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) (at <47ddc45fb441488ba3df69fab6753def>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  9. unitycodergp

    unitycodergp

    Joined:
    Feb 1, 2017
    Posts:
    47
    errisgames:

    I have exactly the same problem : GooglePlayServices.UnityCompat.VersionFromAndroidSDKVersionsEnum (System.String enumName, System.String fallbackPrefKey, System.Int32 fallbackValue) with unity 2019 and api 29 (work correctly with api 28 ...)
     
  10. farooquddin340

    farooquddin340

    Joined:
    Jan 28, 2020
    Posts:
    2
    any solution.?
     
  11. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    To install sdk 29, run Unity hub in admin mode. Completely close Unity hub and your Unity projects. Run Unity hub in admin mode. Open your project from the hub and try to build like normal. When it prompts to update, the update should work.

    (Note, I don't take credit for the solution as I found it elsewhere and it fixed it for me)