Android Builder Tool is a tool for Unity that allows you to quickly build your game for Android while it auto splits your final APK into a small Installer APK and a game data APK. It also allows you to easily sign the new generated APK. (Android LVL license not yet supported).
Legal notice:
This tool is provided for free but you are NOT allowed to sell the tool even if you modify it. You can use/modify the tool to build commercial products.
News And Updates
The previous thread had an unsuitable title and also became rather bulky.
I have made a new package release for the tool: v1.0.1. It’s a rather minor release that just solves a few minor issues and was tested with Unity 3.5.
Version 1.0.1 of the tool is available.
What’s new in version 1.0.1:
the Installer doesn’t override the Unity Product Name string anymore (renamed the strings.xml to installer_strings.xml also renamed “app_name” to “installer_app_name”)
added CustomUnityPlayerProxyActivity class that will auto-start the UnityLauncherActivity or the UnityLauncherNativeActivity (fixes some issues with Sony XPeria Play devices). Now the Installer uses this class to start the corresponding Unity launcher activity.
modified AndroidManifest.xml from Installer Template Project to use custom proxy activity
added Unity libs for Unity 3.5 (you need to link the one you need to the Installer eclipse project)
the Unity sample project using the tool was replaced with a version built with Unity 3.5
==============================================
If you have any feedback regarding the tool, don’t hesitate to send me a PM or write it in this thread and I will get back to you as soon as I can.
Anyone that has successfully used this tool, please help others out too. Help each other for a better community and for a better future.
For the next release I’m gonna try and integrate Google’s XAPK system into the tool replacing my current simple Installer. If anyone manages to accomplish any useful modifications to the tool, please post a link to the modified sources so anyone can benefit from them. Sharing is carrying.
I will soon upload the sources of the tool to a public Mercurial repository and post the link here.
Thank you for all your support and patience so far!
Do I need to make my game read from asset bundles or anything to get this to work or is it a magic bullet solution that will take an existing 200mb+ project and split it up so it just works?
Floky: Cool I’m looking forward to the new version. I think I may need to transition my solution to the UnityProxyActivity. Right now I’m just manually launching based on the code in the proxy version.
hippocoder: No, the goal of this project is to not use any asset bundles but rather the “standard” Resources.Load methods which are faster, use less memory, and take less time to transition from project to project. It’s not as simple as adding a script to your project though. It requires a bit of work in order to get it working, but it is definitely worth it.
It is possible to get the bundle code of the installed gamedata apk directly. It fixes a bug where the User would go in Android “Manage Applications”, select the game and then press on “Clear data”. It would then ask to re-download the data even thought it was still on the SD card.
Just make sure to call the method after you set the path “gameDataFile”.
/**
* Checks if there was a previous version of this app already installed and returns it's version.
* If it doesn't find a previous version it returns 0.
* @return
*/
public int getPreviousAppVersion() {
if ( gameDataFile.exists() )
{
try {
PackageInfo pInfo = getPackageManager().getPackageArchiveInfo(gameDataFile.getAbsolutePath(), 0);
return pInfo.versionCode;
} catch (Exception e) {
Log.e("Installer", "Error while trying to get the version code for the saved app!");
e.printStackTrace();
}
}
return 0;
}
If a phone has no SD Card and plenty of space on the phone, the game data will not download. For most phones it makes sense but some recent phones have lot internal memory.
Devices that do not come bundled with an SD card (or have support for SD card at all for that matter) does have an SD card file directory in its internal file storage. This is virtually an emulation of an SD card, so that applications may target this directory as an external storage media to store itself or its asset files. I have not tested the tool in this thread yet, but using Samsung Galaxy S2 with 16 gb internal memory and no additional SD card installed, I’ve made many apps that I’ve utilized Application.dataPath (etc.) in, and they’ve all stored their necessary data within the “sdcard” directory. I am not sure what will happen if I did insert an SD card, whether or not the path reference in Android would shift itself toward the physical SD card.
Did not work with the HTC Amaze with the tool. Might be the implementation of the tool in this case. Here’s the code in question:
public static boolean isExternalStorageAvailable() {
if (Environment.MEDIA_MOUNTED.equals(Environment
.getExternalStorageState())) {
// We can read and write the media
return true;
}
return false;
}
The code in this tool is actually looking for the physical SD media, in which case yes, the installer should prompt the user if he would like to install it on the internal storage media (internal sdcard directory preferably) instead - or simply do so without prompting.
The code is correct according to Android SDK. The problem is with the manufacturer. The manufacturer can customize the OS kernel and other things behind it and some did not respect the standard, so this code actually returns the virtual external memory flash drive (meaning the internal one no your physical SD card) on an Samsung Galaxy, but on some devices although until now I didn’t know of any, it could look directly for the physical external SD card, like on “HTC Amaze”.
This actually is just 4 steps setup solution to build you 200MB Unity project (with Resources.Load and NO asset bundles) into 2 separate APK files:
an Installer APK that will automatically detect the GPU of the device and look for the game data apk with the texture compression suited for it
an game data APK that will contain all the game assets.
This solution does NOT require any change in your code to make this work. You just have to follow the setups steps correctly and have some basic knowledge of Android SDK and working with an Eclipse Android project.
Regarding:
“So to be clear, I need to make small scenes and only use resources.load? what about if the resources are already included as part of a unity scene?”
No! You don’t need to do anything special with your project. Resources can be linked in the scenes all you want.
It still contains precious information and workarounds for various things. If you have any questions, please search that thread first for answers. A lot of good people contributed with some great feedback there.
Google’s Android SDK documentation states otherwise:
If you check the link provided by jrobichaud you will see that the Installer actually looks for the “external storage” reported by the OS and not the physical SD card. It depends though on the customization of the OS from the manufacturer. (J2ME standard issues all over again ) http://developer.android.com/guide/topics/data/data-storage.html#filesExternal
Yes, this is what I was referring to. This is an awesome tool, you deserve much credit and many thanks for creating it and making it available for people.
Hmm, I have a version working on Windows but it did require me to modify Floky’s tool. Also I’m still using Version 1.0b not 1.0.1.
If interested I can provide the code to call the tool from a Unity editor script and explain how to modify Floky’s tool. That should get you going, but I’d only advise this if you’re desperate as I’m still working on it, don’t have it completely up and running and can’t guarantee anything.