Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
August 12, 2020
arrowPress Releases

If you enjoy reading this site, you might also want to check out these UBM Tech sites:


Why you should care about the package name validity of your Unity project

by Laurent Victorino on 11/19/14 01:31:00 pm   Featured Blogs

4 comments Share on Twitter    RSS

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.


SWITCH is available on iOS and Android (soon on WP)


I’m a C/C++/C# video game developer. I worked for years in the video game Industry for major publishers. When I decided to go indie I naturally chose Unity because of its impressive capabilities but also because of the multiplatform features it proposes. Shortly: I chose Unity because I’m a C/C++/C# video game developer who didn’t want to learn Java/Objective-C/Whatever language to have his games on Android/iOS/Whatever-platform.


Earlier this year I’ve decided to start what I call a “2h mini game dev challenge”: every Friday I make a mini game in 2 hours using Unity. These games were not intended to be published but friends asked me to publish them on Android to have them on their phones.
It all began because of social pressure.

On week 2 I made a game called Switch. I found “Switch” a pretty clever name for a mini game where you have to tap on switches. My company name is Monkey Moon so when Unity asked me for a package name in order to build an Android version of the game I smartly chose com.monkeymoon.switch as I read somewhere that Java package names have to be like backward urls to be valid.

Unity built the app like a charm.

Google Play Store gently accepted the app.

My friends were happy.

The problem

My friends liked Switch so much that they have told their friends about it. And 4 days later websites were talking about Switch. 10 days later Switch had been downloaded more than 10 000 times and received more than 500 reviews on the Play Store. Not bad for a shitty game made in 2 hours.

That’s when I decided to modify the game a little bit to add features and stuff. Originally people could only share their scores on Twitter. I decided to use a Unity plugin to allow them to also share on Facebook.

Everything was ok in the Editor but when I tried to build an APK to publish my modification on the Play Store Unity told me something like “LOL NO!”... In its language it was more “Package name is not a valid package name”.

What I understood

Once again I am not a Java expert, but here is what I understood.
The message about the package name validity was not thrown by Unity, it was the Android SDK. The process when you build an APK seems to be the following:

  1.    Inspect Unity Plugins
  2.    Check the plugins validity
  3.    Build them (this is when I think the message is thrown)
  4.    Build the complete package (including the game)

But to be part of the same APK, plugins use the game package name, in my case com.monkeymoon.switch. But switch is a Java keyword, and package name can’t contain Java keyword.

My game didn’t build for Android anymore (but compiled well on iOS and Windows Phone).

As far as I know Android is the only platform for which Unity calls the SDK itself. For every other platform it generates a modifiable project solution for a specific environment.

I naively rebuilt the game using a different package name (com.monkeymoon.mmswitch). But once I tried to publish it on the Play Store it was Google’s turn to say “LOL NO!”... Package names have to be the same.

I contacted Google to expose my problem and the answer was to remove Switch (com.monkeymoon.switch) from the Play Store (and loose 500 reviews and 10K downloads) and recreate a new Switch (com.monkeymoon.mmswitch).

The solution

I asked Antoine Vianey and Gautier Mechling, Android experts I know, and the only “solution” we found was to decompile, modify, then recompile the APK.

Here is how:

  1.    Download apktool
  2.    Build the APK using Unity and a valid package name such as com.monkeymoon.mmswitch
  3.    Decompile the APK : java -jar apktool.jar d mmswitch.apk
  4.    Edit AndroidManifest.xml and change com.monkeymoon.mmswitch by com.monkeymoon.switch
  5.    Recompile the APK : java -jar apktool.jar b mmswitch -o switch_compiled.apk
  6.    Sign the APK using the keystore : jarsigner.exe -verbose -keystore ../your.keystore switch_compiled.apk switch
  7.    Re-align the APK : zipalign.exe -v 4 switch_compiled.apk switch_signed.apk
  8.    Upload the new APK (switch_signed.apk) on the Play Store
  9.    Et voila

Now I have to decompile, modify, recompile, sign and re-align everytime I want to publish a new version of Switch. Boring, but it seems to work.

In the end

This misery only happened to me because I was dumb. But it would have helped if Unity had thrown a warning. I think Google didn’t care to check the name validity because at first, when you had to be a Java programmer to make Android apps, you couldn’t build an APK using a non-valid package name.

What Unity engineers could do in a near futur to prevent such things :

  -     Throw a warning when the package name is not valid (only Android users will care).
  -     Prevent building an APK using a non-valid package name.
  -     Allow developer to interact during the build process.

I hope my miserable experience will help someone.

Now I have to go, I need to work on my next game called Foreach.

Related Jobs

Mountaintop Studios
Mountaintop Studios — Los Angeles, California, United States

Engine/Systems Engineer (remote)
Mountaintop Studios
Mountaintop Studios — Los Angeles, California, United States

Graphics Engineer (remote)
Mountaintop Studios
Mountaintop Studios — Los Angeles, California, United States

Network Engineer (remote)
Remedy Entertainment
Remedy Entertainment — Espoo, Finland

Senior Gameplay Programmer

Loading Comments

loader image