I'm creating a version of my game for app stores such as Amazon, which don't have the APK expansion mechanism - so I put all the files in my "assets" folder.
However, my 300+ MB APK seems to create a lot of problems:
When I try to install it with ADB on either the emulator or Samsung Galaxy S2, about 75% of the times it fails. From Samsung, I get INSTALL_FAILED_MEDIA_UNAVAILABLE (although it's not mounted, and there's plenty of free space), and from the emulator, I get just 'null'.
Again, this happens about 75% of the time, completely random.
My game locks up at a certain point in native code. There's absolutely nothing there that can lock up or has anything to do with the OS - just plain C++ logic.
I verified that this issue happens ONLY when I push large assets into the APK. If I remove the assets (completely unused, just pushing large files there), the issue doesn't happen.
Just to clarify - in order to test that, I manually pushed the game files into the device, so it has nothing to do with the asset extraction.
This is very weird, and I'm starting to consider getting my own expansion file server.
Any ideas?
UPDATE:
Found the solution to #2. The code base I was using was doing something hackish in the background with the APK assets, that's why it locked up. I removed that code, so #2 is irrelevant.
The only issue now is difficulty installing large APK files.
How about making two seperate apps for the game?
One for the game code and the other for just the large assets. Pardon my intrusion.
I found that the installation problem happens only with ADB.
By manually copying a big APK to the device external storage, and then installing using a file manager app, there is never a problem.
Regarding the 2nd problem - as updated on the original question - it was a specific problem with the app (someone wrote shitty code that manipulates all the APK assets).
Related
The other day I was inspecting "App Info" from an app I'm developing and to my surprise I detected an enormous amount of Mb were being used as "cache" (the app didn't download any content yet, it was just a mockup). At first I thought I could be some heavy libraries I'd added (fresco..) so I decided to create a blank project an try to figure out what was the problem.
I've tried 2 scenarios: pre-lollipop and lollipop. With this I found out there is some difference with the way they handle "data" but the overall apk size was the same. Though here, in pre-lollipop (4.4.4) there was almost no "cache"(FIRST IMAGE) in lollipop... well 8 mb of "cache".
All of this wasn't enough since the other apps I'd developed in lollipop and above had way less "cache". I started thinking what could be the difference and finally I think I've found somthing, gradle version!
The project build with gradle 1.5 has smaller apk size and almost no "cache" (both lollipop and pre-lollipop)
Is there something I'm missing? Why the sudden increase in "cache" size.
Is there any way to avoid this while using the latest gradle version?
Instant Run ships incremental chunks of your app, reflecting changes that you made to the code. That stuff still needs to be loadable by your app, so they apparently are putting that information in some location that gets counted as "cache" (getCacheDir()?).
Similarly, your app's main APK itself will be a bit larger, as it has to contain a chunk of code that knows how to load these dynamically-changing bits.
If you need to measure these values, either disable Instant Run, or run a release build (which automatically is non-Instant Run).
When I install my app on my main/new phone, the installed size is around 18.5MB
and when I install my app on an old Samsung Galaxy Ace (Mk1), for some reason, it installs with pretty much the same size, as you see here:
It runs perfectly on my main phone, but obviously, the old Galaxy Ace really struggles with it.
Now, I download a random game from the Play Store and with that one you can see the results here:
Much better, it takes up less space on the less capable phone than it does on the more capable phone.
However, my question is, where can I start to try to figure out why my app doesn't exhibit this desired behaviour?
Information about my project
I have provided 4 sets of Graphics within my project and they are:
Graphics
XHDPI: Total of 3.73MB
HDPI: Total of 2.87MB
MDPI: Total of 1.33MB
LDPI: Total of 1.03MB
Sound
OGG Sound Files: 202KB
MP3 Soundtrack: 5.6MB
The (Unsigned and signed) APK file is about 16.02MB
Apart from that there is a classes.dex file within the APK which is about 3.5MB.
In Eclipse, I link BaseGameUtils and Google-play-service-lib jar files.
I know that my game is slightly more resource hungry than the other game I downloaded - but that isn't the point of this question. I need to make sure that the size of the installed app is smaller on lesser capable phones than it is 'better' ones but as you can see, mine is exactly the same.
Any help would be appreciated.
Edit
Additional information if it helps:
The Samsung Galaxy Ace is running Android 2.3.4 Gingerbread
The other phone is running Android 4.4.2 Kit Kat
the answer is the picture.. you see android apps can specify locations where apps are supposed to be installed, whether internal or external- you can do that in your android manifest file
android:installLocation="auto"
Looking at your app you from the settings screenshot you have not specified that element in your manifest hence the "move_to_sdCard button" is inactive. Your apps installs in internal memory
coming to the other app, looking at the screenshot you will see that the "move_to_phone button" is active because they specified that feature hence since there wasn't enough space on your device it automatically installed your app on the internal-external memory or strictly external memory.. But when that feature is set not all resources or files are installed on the internal-external memory they are shared, so the size gets trimmed in the process hence that ouput.
Speaking about the lag of your app, you need to digg into your codes pretty much. also newer apis contain functions the old ones do not have, hence you need to re-evaluate the kinds of codes you choose..
Hope i am lucid enough
Probably the "Other App" is using the Multiple APK technique to publish the App on the Play Store. With this feature you can build and deploy several apk(s) each targeting a specific device density screen. In this way you can reduce the apk dimension since each apk will have only the resources for his target and automatically the Play Store will deliver the correct one.
Ever since my Asus Transformer tablet was upgraded to Jelly Bean, I find that app and widget uninstalls are sometimes excruciatingly slow, as in taking several minutes instead of seconds. Could there be a reason for this?
The reason I'm posting this on Stackoverflow is that the apps I'm having the most trouble with are my own developed apps! As you know, when switching between debug and release builds of an app, you have to do an uninstall due to the different signing keys, so I do this on a regular basis and it's getting very annoying. Thanks for any hints on where to look for a solution -- if any.
I had this issue once, though it was in ICS and not Jelly Bean. The problem in my case was Google's app "Currents" which generated thousands of files as part of its cache. It took FOREVER to uninstall anything, or even get the size of any installed app because Android had to chug through all those thousands of files. Google has since fixed Currents, by the way.
So, I would guess that it's a similar issue, one of your installed apps is going nuts with creating files. If you open your app list and it takes a long time for the sizes to show up, that's further evidence that it's the same problem.
I had the same problem. In my case it was caused by SoundCloud's stream cache. After deleting it everything works fine again.
Same problem, also identified by extremely long time to calculate size of apps. In this case it was Google Earth App generating thousands of files (over 22000) on the local drive. Uninstalled that App
and it was fixed.
My current game project is getting large enough that when I deploy for testing I'm waiting a few minutes to actually get this to my phone. Sometimes I have other things to work on, but sometimes I have to sit and wait. This is unfortunately slowing down the development process.
I'm already sure the biggest factor in this is package size. My package is now just under 18 Megs, but I know there are apps out there with much larger packages.
Is there any tricks, phone settings, or eclipse settings that might speed deployment other than reducing the package size?
Regards.
While this doesn't quite meet your criteria of 'other than reducing the package size', my guess is that most of that filesize probably comes from textures and audio resources.
Instead of packing them all in the APK under the res/ folder, I might recommend temporarily copying the resources to the device's filesystem, and then load them from there instead of your resources. Then when you repeatedly upload your APK you don't have to keep transferring the same resources over and over.
If you load your resources from a mostly centralized location it should be just a couple lines of code change to change from loading from res to loading from a file. You can repackage them as resources again when your game is closer to release and you don't have to do so many iterations.
what you want is an android emulator. you can install the emulator as a Eclipse IDE plugin.
http://developer.android.com/tools/sdk/eclipse-adt.html
#"Unfortunately my system is so slow (and old) that the emulator runs like molasses in comparison to running the app on the actual device."
http://dev.blogs.nuxeo.com/2011/10/speeding-up-the-android-emulator.html
I have been working a platforming game for about three months. I had the game working fine, and it worked fine on the Droid when uploaded. Recently, I worked on using director.class and a display group and navigating from the menu to the game using director:changeScene(). This works fine on the emulator with no error messages, but when uploaded to the Droid, the main menu loads just fine, but when I touch a button to load the lua file for the game, the screen goes black and nothing happens. I even un-installed several apps in case it was a memory problem, but that didn't change anything. Any help in what I am missing would be appreciated.
After much searching, I found the answer to my problem: The Corona emulator isn't case sensitive, but the Droid is case sensitive. I found that most of my .png files had uppercase extensions. As an example, pillar.png was actually pillar.PNG in the folder. Apparently, my graphic editor stores the file extension in uppercase by default. When viewing it with Windows Explorer, it wasn't obvious. I viewed them from the command prompt window and found the problem. Also any requires must be exactly the case as the filenames. After making this simple change, the apk deployed on the droid just fine. Also in my searching the forums, I found some other tips. The latest builds of Corona sdk have a problem with files stored in sub directories. Keep all your files in the same directory if you expect to deploy to a Droid.
Jerry
I had similar problem and thanks to #Jerry for pointing out images.
In my case image i included had resolution more than 2048 * 2048 (Maximum resolution allowed by Android as of now)
And reducing the image resolution solved the issue for me.
Kudos!!!