Unity build crashing on android on startup ver: 2020.3.22f1

Hello Unity Folks!
I have created a game on Unity. On Editor it's working fine. But it is crashing on the start-up after making IL2Cpp build for Android. I have been looking for solutions for this for a week but nothing helped me.
I am attaching the crash logs here. please anyone help me to resolve my issue.
Thanks in advance.

--------- beginning of crash
--------- beginning of system
13:23:23.380 Acti...ger  I  Start proc 17567:com.GameOnn.GuessTheMovieQuiz/u0a875 for next_app {com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity}
--------- beginning of main
13:23:43.312 Face...der  D  isSupportAOD:true
13:23:43.312 Face...der  D  isRamless:false
13:23:43.312 Face...der  D  aod versioncode:3140
13:23:43.312 Face...der  D  isSystemUser:true
13:23:43.313 Face...der  D  accountVersion:82810
13:23:50.847 Acti...ger  I  Start proc 19017:com.GameOnn.GuessTheMovieQuiz/u0a875 for next_app {com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity}
13:24:07.312 Acti...ger  I  Start proc 19679:com.GameOnn.GuessTheMovieQuiz/u0a875 for next_app {com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity}
13:24:17.804 iopgp       I  Iopgp: TRANSACTION_IOPGP_ON_INTENT_STARTED sequence_id = 39 pkg_name = com.GameOnn.GuessTheMovieQuiz class_name = com.unity3d.player.UnityPlayerActivity
13:24:17.804 Acti...ger  I  START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity bnds=[244,1633][445,1925] mCallingUid=10457} from uid 10457
13:24:17.813 Task...mpl  D  add ActivityRecord{2aa4e23 u0 com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} t1899} to mActivityRecordSum = Counter{ com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity(1) }
13:24:17.814 Acti...ger  D  getStartingWindowType: newTask=true, taskSwitch=true, processRunning=false, allowTaskSnapshot=true, activityCreated=false, snapshot=null, record:ActivityRecord{2aa4e23 u0 com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} t1899}
13:24:17.814 Oplu...ger  D  isSupportZoomModeWithPolicyLocked: target = com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity
13:24:17.818 Oplu...ger  D  process not running, cold launch: ActivityRecord{2aa4e23 u0 com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} t1899}, processName: com.GameOnn.GuessTheMovieQuiz
13:24:17.825 ANDR...-LM  E  GamePerfEngine: runAsync() 499: Hint is for com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity/30 = 0x1003 PID=2310
13:24:17.851 Acti...ger  I  Start proc 14333:com.GameOnn.GuessTheMovieQuiz/u0a875 for next-top-activity {com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity}
13:24:17.868 Shel...Ext  D  handleRunningTaskInfo:TaskInfo{userId=0 taskId=1899 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity mCallingUid=10457 } baseActivity=ComponentInfo{com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} topActivity=ComponentInfo{com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} origActivity=null realActivity=ComponentInfo{com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} numActivities=1 lastActiveTime=104917355 supportsSplitScreenMultiWindow=false supportsMultiWindow=false resizeMode=0 isResizeable=false minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{android.window.IWindowContainerToken$Stub$Proxy@fe19753} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=0 displayCutoutSafeInsets=Rect(0, 93 - 0, 0) topActivityInfo=ActivityInfo{c5ae890 com.unity3d.player.UnityPlayerActivity} launchCookies=[android.os.BinderProxy@b5c8b42] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isSleeping=false topActivityInSizeCompat=false topActivityInOplusCompatMode=false topActivityEligibleForLetterboxEducation= false locusId=null displayAreaFeatureId=1 cameraCompatControlState=hidden locusId= null topActivityLetterboxInsets=Rect(0, 0 - 0, 0)}
13:24:17.881 Shel...Ext  D  handleRunningTaskInfo:TaskInfo{userId=0 taskId=1899 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity mCallingUid=10457 } baseActivity=ComponentInfo{com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} topActivity=ComponentInfo{com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} origActivity=null realActivity=ComponentInfo{com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} numActivities=1 lastActiveTime=104917355 supportsSplitScreenMultiWindow=false supportsMultiWindow=false resizeMode=0 isResizeable=false minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{android.window.IWindowContainerToken$Stub$Proxy@46455af} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=0 displayCutoutSafeInsets=Rect(0, 93 - 0, 0) topActivityInfo=ActivityInfo{52dfdbc com.unity3d.player.UnityPlayerActivity} launchCookies=[android.os.BinderProxy@b5c8b42] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=true isSleeping=false topActivityInSizeCompat=false topActivityInOplusCompatMode=false topActivityEligibleForLetterboxEducation= false locusId=null displayAreaFeatureId=1 cameraCompatControlState=hidden locusId= null topActivityLetterboxInsets=Rect(0, 0 - 0, 0)}
13:24:17.891 Shel...Ext  D  handleRunningTaskInfo:TaskInfo{userId=0 taskId=1899 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity mCallingUid=10457 } baseActivity=ComponentInfo{com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} topActivity=ComponentInfo{com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} origActivity=null realActivity=ComponentInfo{com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} numActivities=1 lastActiveTime=104917355 supportsSplitScreenMultiWindow=false supportsMultiWindow=false resizeMode=0 isResizeable=false minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{android.window.IWindowContainerToken$Stub$Proxy@34c8145} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=0 displayCutoutSafeInsets=Rect(0, 93 - 0, 0) topActivityInfo=ActivityInfo{754409a com.unity3d.player.UnityPlayerActivity} launchCookies=[android.os.BinderProxy@b5c8b42] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=true isSleeping=false topActivityInSizeCompat=false topActivityInOplusCompatMode=false topActivityEligibleForLetterboxEducation= false locusId=null displayAreaFeatureId=1 cameraCompatControlState=hidden locusId= null topActivityLetterboxInsets=Rect(0, 0 - 0, 0)}
13:24:17.893 Oplu...ice  I  appswitch hasProcess ActivityRecord{2aa4e23 u0 com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} t1899}
13:24:17.893 Oplu...ice  I  appswitch hasProcess ActivityRecord{2aa4e23 u0 com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} t1899}
13:24:17.893 Inpu...her  I  setFocusedApplication displayId=0 ActivityRecord{2aa4e23 u0 com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} t1899}
13:24:17.920 Acti...ger  W    Force finishing activity com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity
13:24:17.924 ANDR...-LM  E  GamePerfEngine: runAsync() 499: Hint is for com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity/30 = 0x1004 PID=2310
13:24:18.014 Shel...Ext  D  handleRunningTaskInfo:TaskInfo{userId=0 taskId=1899 displayId=0 isRunning=false baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity mCallingUid=10457 } baseActivity=null topActivity=null origActivity=null realActivity=ComponentInfo{com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} numActivities=0 lastActiveTime=104917463 supportsSplitScreenMultiWindow=false supportsMultiWindow=false resizeMode=0 isResizeable=false minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{android.window.IWindowContainerToken$Stub$Proxy@9bb39a8} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=0 displayCutoutSafeInsets=Rect(0, 93 - 0, 0) topActivityInfo=null launchCookies=[android.os.BinderProxy@b5c8b42] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isSleeping=false topActivityInSizeCompat=false topActivityInOplusCompatMode=false topActivityEligibleForLetterboxEducation= false locusId=null displayAreaFeatureId=1 cameraCompatControlState=hidden locusId= null topActivityLetterboxInsets=Rect(0, 0 - 0, 0)}
13:24:18.282 Oplu...ger  D  removing: 1899, ComponentInfo{com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity}
13:24:18.282 Task...mpl  D  remove ActivityRecord{2aa4e23 u0 com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} t-1 f}} to mActivityRecordSum = Counter{ }
13:24:18.284 Layer       D  reparent to null sequence=18134, seq[2], name=ActivityRecord{2aa4e23 u0 com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity}#18134
13:24:18.285 Shel...Ext  D  handleRunningTaskInfo:TaskInfo{userId=0 taskId=1899 displayId=-1 isRunning=false baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity mCallingUid=10457 } baseActivity=null topActivity=null origActivity=null realActivity=ComponentInfo{com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} numActivities=0 lastActiveTime=104917463 supportsSplitScreenMultiWindow=false supportsMultiWindow=false resizeMode=0 isResizeable=false minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{android.window.IWindowContainerToken$Stub$Proxy@dc34ba7} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=0 displayCutoutSafeInsets=null topActivityInfo=null launchCookies=[] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isSleeping=false topActivityInSizeCompat=false topActivityInOplusCompatMode=false topActivityEligibleForLetterboxEducation= false locusId=null displayAreaFeatureId=-1 cameraCompatControlState=hidden locusId= null topActivityLetterboxInsets=Rect(0, 0 - 0, 0)}
13:24:18.422 Acti...ger  W  Activity top resumed state loss timeout for ActivityRecord{2aa4e23 u0 com.GameOnn.GuessTheMovieQuiz/com.unity3d.player.UnityPlayerActivity} t-1 f}}
13:24:18.701 Scen...ity  D  onAppSwitchEvent: AppSwitchEvent(eventType=2, targetName=com.android.launcher, firstStart=false, multiApp=false, windowMode=0, resumingPackageName=com.GameOnn.GuessTheMovieQuiz, resumingActivityName=com.unity3d.player.UnityPlayerActivity, isResumingMultiApp=false, isResumingFirstStart=true)

Time to start debugging! Here is how you can begin your exciting new debugging adventures:

You must find a way to get the information you need in order to reason about what the problem is.

Once you understand what the problem is, you may begin to reason about a solution to the problem.

What is often happening in these cases is one of the following:

  • the code you think is executing is not actually executing at all
  • the code is executing far EARLIER or LATER than you think
  • the code is executing far LESS OFTEN than you think
  • the code is executing far MORE OFTEN than you think
  • the code is executing on another GameObject than you think it is
  • you're getting an error or warning and you haven't noticed it in the console window

To help gain more insight into your problem, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.

Doing this should help you answer these types of questions:

  • is this code even running? which parts are running? how often does it run? what order does it run in?
  • what are the names of the GameObjects or Components involved?
  • what are the values of the variables involved? Are they initialized? Are the values reasonable?
  • are you meeting ALL the requirements to receive callbacks such as triggers / colliders (review the documentation)

Knowing this information will help you reason about the behavior you are seeing.

You can also supply a second argument to Debug.Log() and when you click the message, it will highlight the object in scene, such as Debug.Log("Problem!",this);

If your problem would benefit from in-scene or in-game visualization, Debug.DrawRay() or Debug.DrawLine() can help you visualize things like rays (used in raycasting) or distances.

You can also call Debug.Break() to pause the Editor when certain interesting pieces of code run, and then study the scene manually, looking for all the parts, where they are, what scripts are on them, etc.

You can also call GameObject.CreatePrimitive() to emplace debug-marker-ish objects in the scene at runtime.

You could also just display various important quantities in UI Text elements to watch them change as you play the game.

Visit Google for how to see console output from builds. If you are running a mobile device you can also view the console output. Google for how on your particular mobile target, such as this answer for iOS: https://discussions.unity.com/t/700551 or this answer for Android: https://discussions.unity.com/t/699654

If you are working in VR, it might be useful to make your on onscreen log output, or integrate one from the asset store, so you can see what is happening as you operate your software.

Another useful approach is to temporarily strip out everything besides what is necessary to prove your issue. This can simplify and isolate compounding effects of other items in your scene or prefab.

If your problem is with OnCollision-type functions, print the name of what is passed in!

Here's an example of putting in a laser-focused Debug.Log() and how that can save you a TON of time wallowing around speculating what might be going wrong:

https://discussions.unity.com/t/839300/3

"When in doubt, print it out!(tm)" - Kurt Dekker (and many others)

Note: the print() function is an alias for Debug.Log() provided by the MonoBehaviour class.

If there isn't anything useful in the crash log you may need to begin to bisect the problem space to find out what is causing the problem.

How to troubleshoot build failures:

First, make a blank project with a single blank scene and prove that it builds successfully.

If the blank project does NOT build, go fix your Unity installation or your other tools, such as Android SDK, NDK, JDK, etc. It may even be necessary to change to a different version of Unity3D. It is generally best to stay with LTS versions of Unity3D.

Until you can build a blank project to the target platform, don't fiddle with anything else.

Once you can build a blank project, now bisect the problem by bringing over parts of your current project and building it one subsystem at a time, perhaps stubbing things out that might trigger compiler errors.

Most often things that prevent building are third-party libraries such as Firebase.

Once you identify the subsystem, go to the documentation for it and make sure you are doing it correctly.

It may also be helpful to work through a tutorial or two for whatever subsystem is making the build fail.

Android build not building:

Recently (circa July 2022) there have been reports of Unity's installer failing to install the Android Tools.

https://discussions.unity.com/t/887277

Here was how I brought up Unity2020.3.41 and the Android SDK 31 on October 30, 2022 (edited on August 23, 2023 to include Android SDK 33...):

https://discussions.unity.com/t/891017/7

Android Gradle errors and other related stuff:

https://discussions.unity.com/t/901712/2

hi @Kurt-Dekker Thanks for the reply.
I have debugged this and found the issue but added many solutions provided on the forum but did not help any of them.

The issue is still build getting crashed on the startup.

Error:

Getting this error. I have tried multiple solutions but still getting the error.

`FATAL EXCEPTION: main Process: com.GameOnn.GuessTheMovieQuiz, PID: 27569 java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:

                       ******************************************************************************
                       * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
                       * should follow the instructions here:                                       *
                       * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
                       * to add a valid App ID inside the AndroidManifest.                          *
                       * Google Ad Manager publishers should follow instructions here:              *
                       * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
                       ******************************************************************************


                           at android.app.ActivityThread.installProvider(ActivityThread.java:7968)
                           at android.app.ActivityThread.installContentProviders(ActivityThread.java:7474)
                           at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7232)
                           at android.app.ActivityThread.-$Nest$mhandleBindApplication(Unknown Source:0)
                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2296)
                           at android.os.Handler.dispatchMessage(Handler.java:106)
                           at android.os.Looper.loopOnce(Looper.java:240)
                           at android.os.Looper.loop(Looper.java:351)
                           at android.app.ActivityThread.main(ActivityThread.java:8416)
                           at java.lang.reflect.Method.invoke(Native Method)
                           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
                       Caused by: java.lang.IllegalStateException:

                       ******************************************************************************
                       * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
                       * should follow the instructions here:                                       *
                       * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
                       * to add a valid App ID inside the AndroidManifest.                          *
                       * Google Ad Manager publishers should follow instructions here:              *
                       * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
                       ******************************************************************************


                           at com.google.android.gms.internal.ads.zzxw.attachInfo(com.google.android.gms:play-services-ads-lite@@18.3.0:27)
                           at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@18.3.0:3)
                           at android. app.ActivityThread.installProvider(ActivityThread.java:7963)
                           ... 11 more
14:27:58.766 IHan...ion E HANS printMessageBody: RCV message: type = 0,port = 86870,caller_pid = 1753,caller_uid = 1047,target_pid = 20430,target_uid = 10253,pkg_cmd = -1,rpc = android.hardware.ICameraServiceLi`

I have added the Application_id and its value but it did not solve the issue.

Android Manifest.xml

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package=" com.google.unity.ads" android:versionName="1.0" android:versionCode="1"> <application> <uses-library android:required="false" android:name="org.apache.http.legacy" /> <uses-permission android:name="com.android.vending.BILLING" /> <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-4629266488559291~XXXXXXXXXX" /> <meta-data android:name="com.google.android.gms.ads.AD_MANAGER_APP" android:value="true" /> </application> </manifest>

I'm getting Android crash on launch now but only for Android 14 and I think it's Firebase 11.4.0. It's a pain but I can recommend the start from scratch method and just bring in the SDK's you use one at a time and then build and run.

I'm using Unity 2022.3.8 and find the it's doing a great job at adding everything it needs when creating it's own AndroidManifest (Uncheck Custom Main Manifest in Publisher Settings).
If you drag the build APK into android studio it will open it up so you can see the manifest it has created.


were you able to resolve crash issue on android 14 ?


Yep Google put out an update to Firebase. Grab the latest and it should work. I've not tried 11.6.0 but 11.5.0 works for me https://firebase.google.com/support/release-notes/unity