Unity 6 Android game crashes on Android 9 device

10-18 19:25:18.686 31140 31140 D AndroidRuntime: Shutting down VM
10-18 19:25:18.686 31140 31140 E AndroidRuntime: FATAL EXCEPTION: main
10-18 19:25:18.686 31140 31140 E AndroidRuntime: Process: com.UnityTechnologies.com.unity.template.urpblank, PID: 31140
10-18 19:25:18.686 31140 31140 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.UnityTechnologies.com.unity.template.urpblank/com.unity3d.player.appui.AppUIGameActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3220)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3355)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2089)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at android.os.Looper.loop(Looper.java:243)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7172)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:511)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:926)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:889)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:763)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:203)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at com.google.androidgamesdk.GameActivity.onCreateSurfaceView(GameActivity.java:274)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at com.unity3d.player.UnityPlayerGameActivity.onCreateSurfaceView(UnityPlayerGameActivity.java:57)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at com.google.androidgamesdk.GameActivity.onCreate(GameActivity.java:304)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at com.unity3d.player.UnityPlayerGameActivity.onCreate(UnityPlayerGameActivity.java:35)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at com.unity3d.player.appui.AppUIGameActivity.onCreate(AppUIGameActivity.java:241)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7268)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7259)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1275)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3200)
10-18 19:25:18.686 31140 31140 E AndroidRuntime: … 11 more
10-18 19:25:18.691 1623 4605 W ActivityManager: Force finishing activity com.UnityTechnologies.com.unity.template.urpblank/com.unity3d.player.appui.AppUIGameActivity
10-18 19:25:18.692 1623 31163 W DropBoxManagerService: Dropping: backup_crash (2867 > 0 bytes)

Do you have custom templates enabled in your project?

No, just a blank default URP 3D project

Please, report a bug for this, so that we can investigate it.

I am also seeing this exception when trying to launch our build on a Meta Quest 3 device.

I guess this is coming from App UI | App UI | 2.0.0-pre.11, it seems to generate invalid AppUIGameActivity activity. Is that package present in the project?

Yes, this package is enabled, and it can’t be removed!

It says installed as dependency, probably some other package is including it. You can check Packages/manifest.json and try removing one package by one, though it might affect template’s functionality.

Anyways I notified the people developing app ui.

P.S

  • what Unity version are you using?

Still, I tried creating new project with Unity 6000.0.23f1 using Universal 3D template and there’s no app ui package included.

It seems to be used by the Behavior package, maybe I installed it by mistake.


I removed the Behavior package, the Pre package App UI also gone, still crashes

10-21 10:46:45.305  1252  1252 D AndroidRuntime: Shutting down VM
10-21 10:46:45.306  1252  1252 E AndroidRuntime: FATAL EXCEPTION: main
10-21 10:46:45.306  1252  1252 E AndroidRuntime: Process: com.UnityTechnologies.com.unity.template.urpblank, PID: 1252
10-21 10:46:45.306  1252  1252 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.UnityTechnologies.com.unity.template.urpblank/com.unity3d.player.appui.AppUIGameActivity}: java.lang.ClassNotFoundException: Didn't find class "com.unity3d.player.appui.AppUIGameActivity" on path: DexPathList[[zip file "/data/app/com.UnityTechnologies.com.unity.template.urpblank-uHcMQj7A9HtGepEj-qjomQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.UnityTechnologies.com.unity.template.urpblank-uHcMQj7A9HtGepEj-qjomQ==/lib/arm64, /data/app/com.UnityTechnologies.com.unity.template.urpblank-uHcMQj7A9HtGepEj-qjomQ==/base.apk!/lib/arm64-v8a, /system/lib64]]
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3141)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3355)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2089)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:243)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7172)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:511)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
10-21 10:46:45.306  1252  1252 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.unity3d.player.appui.AppUIGameActivity" on path: DexPathList[[zip file "/data/app/com.UnityTechnologies.com.unity.template.urpblank-uHcMQj7A9HtGepEj-qjomQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.UnityTechnologies.com.unity.template.urpblank-uHcMQj7A9HtGepEj-qjomQ==/lib/arm64, /data/app/com.UnityTechnologies.com.unity.template.urpblank-uHcMQj7A9HtGepEj-qjomQ==/base.apk!/lib/arm64-v8a, /system/lib64]]
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at android.app.Instrumentation.newActivity(Instrumentation.java:1219)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3129)
10-21 10:46:45.306  1252  1252 E AndroidRuntime:        ... 11 more
10-21 10:46:45.309  1623  1322 W DropBoxManagerService: Dropping: backup_crash (3394 > 0 bytes)
10-21 10:46:45.310  1623  9835 W ActivityManager:   Force finishing activity com.UnityTechnologies.com.unity.template.urpblank/com.unity3d.player.appui.AppUIGameActivity
10-21 10:46:45.314  1623  9835 D ActivityTrigger: ActivityTrigger activityPauseTrigger
10-21 10:46:45.317  1623  9835 D AppCrash: com.UnityTechnologies.com.unity.template.urpblank crashed,  exceptiontpye is java.lang.ClassNotFoundException
10-21 10:46:45.318  1623  9835 D AppCrash: com.UnityTechnologies.com.unity.template.urpblank appCrashCount:2

Try doing clean build, there’s dropdown next to Build button. I assume App UI package is not incremental friendly with build pipeline, so its changes persisted

Same crashes after clean build

It still mentions AppUIGameActivity in the log, that means somehow it still uses that overriden activity. Might be a bit extreme, but you could try deleting project’s Library folder and then try to build again.

Any news on this issue? I just encounter this issue. The app immediatly crashes when I launch it in the headset with this error.

I build a project with Unity 6000.0.23f1 for the Vive XR Elite, but I use the Behavior package and can’t remove it…

Hello, it seems the defined theme in the Android manifest is not compatible with an Android GameActivity.

You should have an Assets/Plugins/Android/AndroidManifest.xml file in your project. If you don’t you can generate it via Edit > Project Settings > Player checking the Publishing Settings > Custom Main Manifest checkbox. You also can modify this manifest file directly in the generated Gradle project in Android Studio.

The manifest should have the theme set to @style/BaseUnityGameActivityTheme for the GameActivity.

Example:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" xmlns:tools="http://schemas.android.com/tools">
  <application android:usesCleartextTraffic="false" android:allowBackup="false">
    <activity android:name="com.unity3d.player.appui.AppUIGameActivity" android:theme="@style/BaseUnityGameActivityTheme" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
      <meta-data android:name="android.app.lib_name" android:value="game" />
    </activity>
  </application>
  <uses-permission android:name="android.permission.VIBRATE" />
</manifest>