Bret Hudson's avatar
Hi! I'm
Bret Hudson
The kid who wanted to do everything. I'm a Seattle-based software/web developer who makes indie games in his free time. Check out my works!

Fixing Live Wallpapers Crashing on Samsung Devices

With 2021 rolling around, many people are finding themselves creating New Year's resolutions. As someone who doesn't participate in aligning my self-improvement schedule with the changing of the calendar year, I was surprised to hear Pixelscapes Wallpaper screaming "New Year, New Me" as the clock struck midnight. Honestly, a terrifying way to begin 2021.

Unlike us mere mortals, Pixelscapes is an app and doesn't have the ability for self-change. So, I had to do some work to help it out. Let's take a little history trip back to everyone's favorite year for some much needed context.

Samsung update breaks Pixelscapes

Beginning September 2020, Samsung started rolling out a software update with One UI 2.5 to eligible devices. What I didn't expect was that this update would break Pixelscapes. Any user that updated their device saw the wallpaper crash immediately upon starting, rendering it impossible to use.

This was brought to my attention by our many users who left reviews letting us know it stopped working. Thank you to those users, for both for letting us know things were broken, and for patiently waiting for an update.

First things first, I checked to see if any other live wallpapers had been facing similar issues on Samsung devices in recent months. I figured something very specific had changed on Samsung devices that someone else had already discovered. So, I begun a search late November 2020. We had the following error to go off of.

java.lang.NullPointerException: 
  at android.service.wallpaper.WallpaperService$Engine.attach (WallpaperService.java:1371)
  at android.service.wallpaper.WallpaperService$IWallpaperEngineWrapper.executeMessage (WallpaperService.java:1784)
  at com.android.internal.os.HandlerCaller$MyHandler.handleMessage (HandlerCaller.java:44)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:8167)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:496)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1100)

The only result that had any relevance was this post on the Samsung Developer forums describing the same exact error I was seeing. Unfortunately, Samsung Developer Program staff told the poster, kuo1600352236, that it wasn't the right place to post his question. Our first dead end. But at least I knew that other developers had been seeing the same issue with their wallpapers!

Dead ends can't stop me

I took the week after Christmas off of work, and was feeling motivated to finally debug what was going on with the app. I ended up buying a refurbished Samsung S9, which arrived New Year's Eve.

Before I got my hands dirty with documentation, I decided to give Google search one more try. I tried adding "One UI 2.5" to my search query, and, sure enough, I started to see more users running into a similar bug with a Unity package called uLiveWallpaper. There was one post in particular that seemed to be exactly what I was searching for.

If you have sources then you just need to add super.onCreate() in method onCreate() of UnityWallpaperService class.

That's a pretty easy fix and an amazing oversight. Thankfully my bug couldn't be that.

Surely my bug couldn't be that.

Right?

...right?

Adding super.onCreate() to

All I needed to do was make my wallpaper, which extends WallpaperService, to call the onCreate method that it was overriding. It was really that simple.

Pixelscapes is working again!

After a good amount of frustration and a few months of people leaving reviews on the app, I finally had found the solution online and updated the app, which went live yesterday. It feels amazing having this resolved. Users being disappointed that the wallpaper that they've stuck with over the years isn't working anymore is not something I enjoyed watching, and I hope that future Android updates don't cause any breaking bugs like this.

Hopefully this post can help others running into the same bug, without having to spend hours digging through Google search results.

If anyone has any questions about either Pixelscapes or developing live wallpaper apps, feel free to leave a comment here or tweet @BretHudson. I'll do my best to help.