Android app crashes on startup NullPointerException VerifyOBBOnStartUp

Hi,

07-26 07:53:09.634: E/AndroidRuntime(27128): FATAL EXCEPTION: main 07-26 07:53:09.634: E/AndroidRuntime(27128): Process: xyz.edhash.games.bumpex2.release, PID: 27128 07-26 07:53:09.634: E/AndroidRuntime(27128): java.lang.RuntimeException: Unable to start activity ComponentInfo{xyz.edhash.games.bumpex2.release/xyz.edhash.games.bumpex2.release.DownloaderActivity}: java.lang.NullPointerException: Attempt to read from field 'boolean com.epicgames.ue4.GameActivity.VerifyOBBOnStartUp' on a null object reference 07-26 07:53:09.634: 

Your error message tells me that it is unable to start Downloader Activity because Downloader Activity is trying to read this variable com.epicgames.ue4.GameActivity.VerifyOBBOnStartUp from Game Activity. Game Activity read this variable from the Manifest file.

Here is the code from DownloaderActivity.java where it tries to read the variable from GameActivity.java :

	private void ProcessOBBFiles()
	{
		if(GameActivity.Get().VerifyOBBOnStartUp && !expansionFilesUptoData()) {
				validateXAPKZipFiles();
		} else {
				OutputData.putExtra(GameActivity.DOWNLOAD_RETURN_NAME, GameActivity.DOWNLOAD_FILES_PRESENT);		
				setResult(RESULT_OK, OutputData);
				finish();
				overridePendingTransition(R.anim.noaction, R.anim.noaction);
		}
	}

This chain from DownloaderActivity → GameActivity.java → AndroidManifest.xml where it reads bVerifyObbOnStartUp is broken. I would still bet that this is where the error lies.

Also can you check your actual manifest file thats on your android phone and confirm that the meta data is present ?

Thanks

Hi, were you able to resolve this issue?

Hi,

Steps to reproduce the issue

  1. Opens the game for the first time after installation, it verifies OBB and opens the game just fine.

  2. I exit normally and totally close the application from Android then re-open again, it crashes after showing the splash screen.

  3. To make it work again, I must delete the application and re-install it again.

  4. Got the exception from logcat as following

    07-26 07:53:09.634: E/AndroidRuntime(27128): FATAL EXCEPTION: main 07-26 07:53:09.634: E/AndroidRuntime(27128): Process: xyz.edhash.games.bumpex2.release, PID: 27128 07-26 07:53:09.634: E/AndroidRuntime(27128): java.lang.RuntimeException: Unable to start activity ComponentInfo{xyz.edhash.games.bumpex2.release/xyz.edhash.games.bumpex2.release.DownloaderActivity}: java.lang.NullPointerException: Attempt to read from field ‘boolean com.epicgames.ue4.GameActivity.VerifyOBBOnStartUp’ on a null object reference 07-26 07:53:09.634: E/AndroidRuntime(27128): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2339) 07-26 07:53:09.634: E/AndroidRuntime(27128): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2413) 07-26 07:53:09.634: E/AndroidRuntime(27128): at android.app.ActivityThread.access$800(ActivityThread.java:155) 07-26 07:53:09.634: E/AndroidRuntime(27128): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317) 07-26 07:53:09.634: E/AndroidRuntime(27128): at android.os.Handler.dispatchMessage(Handler.java:102) 07-26 07:53:09.634: E/AndroidRuntime(27128): at android.os.Looper.loop(Looper.java:135) 07-26 07:53:09.634: E/AndroidRuntime(27128): at android.app.ActivityThread.main(ActivityThread.java:5343) 07-26 07:53:09.634: E/AndroidRuntime(27128): at java.lang.reflect.Method.invoke(Native Method) 07-26 07:53:09.634: E/AndroidRuntime(27128): at java.lang.reflect.Method.invoke(Method.java:372) 07-26 07:53:09.634: E/AndroidRuntime(27128): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) 07-26 07:53:09.634: E/AndroidRuntime(27128): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700) 07-26 07:53:09.634: E/AndroidRuntime(27128): Caused by: java.lang.NullPointerException: Attempt to read from field ‘boolean com.epicgames.ue4.GameActivity.VerifyOBBOnStartUp’ on a null object reference 07-26 07:53:09.634: E/AndroidRuntime(27128): at xyz.edhash.games.bumpex2.release.DownloaderActivity.f(Unknown Source) 07-26 07:53:09.634: E/AndroidRuntime(27128): at xyz.edhash.games.bumpex2.release.DownloaderActivity.onCreate(Unknown Source) 07-26 07:53:09.634: E/AndroidRuntime(27128): at android.app.Activity.performCreate(Activity.java:6010) 07-26 07:53:09.634: E/AndroidRuntime(27128): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129) 07-26 07:53:09.634: E/AndroidRuntime(27128): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292) 07-26 07:53:09.634: E/AndroidRuntime(27128): … 10 more

What I tried is,

  • Disabling verify OBB on startup and it also failed with same exception.
  • Packaging development version instead of shipping, also failed.
  • Installing it via Google Play or by .bat file, it fails in both.
  • Disabling the internet connection from the phone while opening up the game the first time after installation, this results on opening up the game successfully every time until I turn on the internet connection again it then crashes on the second attempt and keep on crashing ever since until I re-install again.

Hi hossam.,

Check your Android manifest file and see if there is a meta data for bVerifyOBBOnStartUp and set it to false. I think that your android app is trying to read this variable and it is not finding it anywhere. In my AndroidManifest.xml, I have something like this:

I have already tried checking Disable verify OBB on start, I also tried your solution setting bVerifyOBBOnStartUp to false in AndroidManifest.xml in [Project]\Intermediate\Android\APK but still facing the same issue.

Hi,

Yes, I can get that it fails here but what I can’t get is why it is failing although everything should be normal with the obb, I even created another new project and copied the maps into it but still both projects fail with the same error. Also tried to change the package name…

I checked the manifest file on the device itself and all metadata are present.

Much appreciated.

Hi,

One last thing…after this I am out of ideas …

How come your package doesn’t start with ‘com’ ? Your current package name says ‘xyz.edhash.games.bumpex2.release.DownloaderActivity’… is this legal ? Does your GameActivity reside in a package ‘com.epicgames.ue4’ ?

Thanks

My domain is .xyz and not .com that is why I use .xyz instead. I think GameActivity class resides inside com.epicgames.ue4 as it is developed by epic games in unreal engine and not by me.

Yes, GameActivity.java resides inside com.epicgames.ue4. Also you did
set the variable bVerifyObbOnStartUp from the Project Settings tab as shown in the picture. I also assume that the package names are mentioned correctly in the activity files.

The only other option is to set a breakpoint on the line where this variable is being read and see whats going on.

Hi,

Yes, I was able to fix it by removing the Google Cloud Messaging SenderID value that is in Google Play Service configurations in project settings and keeping it blank to disable it. I had a valid value in it before but don’t use it anyway, so I don’t have this crash any more after keeping it blank to disable it which is pretty weird to me actually.

Thanks a lot for your support.