Google Play OBB Downloader crashes with NullPointerException when obb download launched

I’m using the Unity Google Play OBB Downloader plugin with Unity 5.3.4. Configuration was straightforward (public key etc are all set). But when I try to start the obb download with GooglePlayDownloader.FetchOBB() > com.unity3d.plugin.downloader.UnityDownloaderActivity.onCreate() the app crashes due to NullPointerException in the Unity plugin initialization code.

Hoping for advice as this is blocking our beta launch

Note on replicating the bug: In North America by default the install from google play automatically also downloads the .obb so the downloader usually has nothing to do. To replicate the bug I install from gplay, then manually remove the .obb, then launch the app. The “Start Download” button appears (correct) but when I click it to start the obb downloader the app crashes immediately with NPE in the downloader activity onCreate().

It may be a problem with missing resources, the stack trace below shows it is crashing when trying to add a click handler to a button – perhaps the plugin resources don’t get integrated into the build correctly with Unity 5? But I’m not sure. Unity 5.3 plugin architecture manages the resources differently than earlier releases. The last update to the plugin was Feb 2015 so it has not been updated to the new Android LIbrary .aar style (maybe that would solve it)

Example stack trace of the crash

E/AndroidRuntime(20851): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)’ on a null object reference
E/AndroidRuntime(20851): at com.unity3d.plugin.downloader.UnityDownloaderActivity.onCreate(Unknown Source)
E/AndroidRuntime(20851): at android.app.Activity.performCreate(Activity.java:6289)
E/AndroidRuntime(20851): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
E/AndroidRuntime(20851): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
E/AndroidRuntime(20851): … 10 more

It sounds a bit like your download dialog is missing resource files from somewhere?

I’d have a look inside your Assets\Plugins\Android folder and make sure everything is there. On mine I have:

src folder (with src\com\google and src\com\unity3d)
bin folder (with bin\obfuscated_googleplaydownloader.jar)
res folder (should have res\layout\main.xml etc…)