In my project I am using a few drawables for creating good looking UI and the strange problem I got is it working good on Kindle Fire with 2.3.4 version properly and occupying just 2.8397MB only, but when I run the same application in nexus 4.2.1 device it is taking 23.45678MB to 30MB and running very slowly, I thought the problem would be on drawables so created 9 Patch for them but still getting same problem.
On pre-honeycomb devices (like the 2.3.4 Kindle Fire) bitmaps are stored in native heap, which doesn't show up when analyzing the dalvik heap memory usage in ddms.
This does not mean that it won't still count against the heap limit, however.
Honeycomb and later devices store bitmaps in the dalvik heap which will show up in ddms. That should explain why the memory usage is much "less" on the Kindle Fire. It isn't, it just appears that way.
Do you have different drawable folder per resolution ? if so, it could be that this is related to the resources you have in the different folders so that the drawables loaded on your Nexus are significantly larger than the ones loaded on your kindle fire (The kindle fire has a 1024x600 resolution while the Nexus 7 has a 1280x800 resolution)
Related
I am working on an android Audio Recording application, our app is currently designed to work on all android phones, the Nexus 7 and the Motorola Xoom tablets.
I was wondering if there are any guidelines or best practices to re-design/modify our app for Nexus 10. More specifically, any pointers on the below points would be really helpful:
UI guidelines to support the new 2560x1600 resolution
Android resource files related modifications (based on similar guidelines)
Any sample or open sources apps that have been modified to work on the nexus 10
Best practices creating and running a nexus 10 emulator since there is no such AVD device by default (screenshot below). Any thoughts on creating one, keeping the high resolution in mind.
As long as you have xhdpi assets, and layouts made for 10" tablets, you shouldn't have to do anything (except add a new xxhdpi launcher icon, as #Mattias mentioned).
To make a Nexus 10 AVD, navigate to Device Definitions:
Then, click New Device. Fill it out something like this:
Now it will be listed in the devices drop-down that you show above.
Regarding your second point, resources:
While the nexus 10 is a xhdpi device, it will use the launcher icon from xxhdpi "one bucket up" if available, so make sure to provide one as it will look much better/clearer/sharper. Reason is that there is room for a bigger icon on this device. Launcher icon size at xxhdpi is 144x144 pixels.
For reference see:
https://plus.google.com/118292708268361843293/posts/ePQya3KsTjW
The best way to emulate the Nexus 10 is to use AndroVM. I am currently running Android on it with the full Nexus 10 2560x1600 resolution and it fits onto my HD screen if I set AndroVM to use 320dpi.
Oh.. and it's VERY fast :-)
I personally use it over emulators and real hardware devices as it's extremely responsive and the deployment of the APK is lightning fast.
I do not contribute to the AndroVM project myself by the way, but it has speeded up my own development cycle considerably. In all development cycles, a developer waiting to see if their code tweaks work using an emulator or a hardware device adds considerable time overhead. I would thoroughly recommend using AndroVM regardless of screen size during normal code development.
I'm trying to make my app ICS-compatible and I'm getting OutOfMemoryErrors that I never got with 2.3.3 and earlier. I don't own an ICS device so I'm using the emulator and I noticed the default heap size is 24M, which is the same as previous versions (on the emulator).
Is 24M the default heap size on actual devices? What about the Google Nexus?
Thanks in advance...
Answering my own question:
I did not find the exact size, in fact it is likely different on different devices, but I can confirm it's bigger than 24Mb after I tested my app on a Google Nexus and didn't get any OOM errors. The emulator probably defaults to 24Mb for all OS versions.
is there a list of android devices and their heap size?
I know how to check programmatically in the app, but I am curious to know.
I have devices with android heaps 32M and greater, and they have at least 512MB RAM. Could I simply assume that all devices with 512MB Ram have 32M of heap? And that devices with less ram have less heap? (16mb? 24mb? ???)
thanks
is there a list of android devices and their heap size?
Not that I am aware of.
Could I simply assume that all devices with 512MB Ram have 32M of heap?
Heap size recommendations are driven more by Android OS release and screen size. Android OS release and screen size also have an impact on minimum effective RAM on the device. So the concepts are loosely correlated, but that's it.
I'd like a list so I could determine mainly if Android 2.2+ devices with 16mb heap exist
AFAIK, you cannot rule out that combination. After all, please remember that Android is open source, so modded ROMs are welcome to configure heap sizes however they want. IIRC, at least one allows the user to choose the heap size. And there are no rules regarding device RAM or heap size in the Compatibility Definition Document, so device manufacturers are welcome to try odd combinations.
Well, you can't assume absolutely anything. There may be a trend like heaps of size 32mb+ on devices with 512mb+ memory. But that's just a trend, not a rule.
There are sofar 4 different types(based on heap size) of android devices.
Those are:
G1----16MB
Droid-24MB
Nexus one-36MB
XOOM-48MB.
XOOM is the device which has highest heap memory.
A source that could help guessing is also if you create emulators. If you create an emulator for Android 1.5, it doesn't automatically adds the "Max VM application heap size" attribut under hardware. But starting with Android 1.6 it sets it automatically to 24 MB. If you choose Android 4.0.3 then it sets it automatically to 48 MB. Maybe that's some kind of typical minimal heap sizes for these Android versions.
EDIT: Just found this: https://stackoverflow.com/a/2634738/1037994. So combining the emulator attribut with this statement, I would guess 24 MB as minimum for Android 2.2+ devices.
I made an android game with cocos2d-android.
When I test this game on different devices, the RAM usage is varied:
Samsung Galaxy Note (2.3.5):
Task-Manager show: about 17MB
Watchdog: about 23MB
Debug: about 10MB (Debug.getNativeHeapAllocatedSize() / 1048576L)
Samsung Galaxy I9000 (2.3.3):
Task-Manager: about 55MB
Watchdog: about 42MB
Debug: about 25MB
Emulator (2.3.3 && 3.2):
Debug: about 40MB
I don't have a clue why the memory consumption on different devices of the same game is varied like this. Has anybody an answer?
Each of those devices are running a different version of Android, and are likely running different types of software in the background.
If your not experiencing any problems, and your users aren't complaining - I dont see anything to worry about.
Samsung Galaxy I9000 has a heap size of 64MB. Galaxy Note has a heap size of 128MB. In the emulator a heap size of 24MB is default but of course you can choose any size.
I am still don't know exactly why the ram usage is that much different, but it seems to have something to do with the bitmaps I use for the game. In the newest version I added low resolution bitmaps for low-end devices. If I turn on the low resolution bitmaps on the I9000 the ram usage is decreasing strongly. If I start the game with low-resolution bitmaps on the galaxy note the ram usage decrease is much smaller, nonetheless the game works smooth on both devices with sd and hd graphics and the user feedback in the android market is positive too.
Hi
i have developed an application and it smoothly running in all phones except Htc Eris, in Htc Eris i get out of memory exception, null pointer exception etc, but these problem i never see in my samsung galaxy or motrolloz milestone or spice mobile, i need to know any problem in Htc Eris, like low memory ,low processing power etc
The "Heap Size" on the Htc Eris's factory ROM is at 16M and the other phones are 24M and higher.
You need to try to optimize your application as best as possible so it cam run on the phones with a smaller heap ( ..or virtual memory - similar to the virtual disc size on Windows). A good place to start and easiest is to optimize all your drawables and don't put any PNG's in the drawable folder; these images are not compressed at run time like the other drawable folders. ie. drawable-hdpi. I discovered this by accident when I but a wallpaper in that folder - I was getting the same errors as you. Moving the PNG to the /drawable-hdpi folder alone cleared it.