I've been trying to improve the app startup time of my app without any success. I'm using MvvmCross, but based on my logs, the slowdowns seem to occur before it even gets to the MvvmCross initialization part. Once it gets there, it seems to be quite fast. I even tried removing all my initialization code, yet that did not make any difference to the slow startup.
Based on log, I can see that time is lost when libraries/plugins are being imported and I have no idea how to improve this. I tried linking everything, but I didn't gain much in startup speed. The only significant speed up was after using AOT compiling, but that results in ridiculously large .apk with an even bigger install size of ~200-300mb, which is unacceptable.
I need help on improving the app startup time without compromising the application size.
Related
For the few days, I've been trying to find out why my app allocates massive amounts of memory and crashes. I'll open a few layouts that admittedly is not optimized. But I cant figure out why sometimes StartActivity() will allocate up to 80MB at a time, and why that memory wont release when I close the activity.
I created a test application filled with images and two layouts that call each other. Using Xamarin Profiler, I came across this memory dump, and I cant figure out what is calling this and how can I have it called more often for my real app?
Please, any insights would be lovely.
I cant figure out what is calling this and how can I have it called more often for my real app?
The Memory Profiler in Android Studio can help you to see how your app allocates memory over over time. It could also be used for xamarin android app.
And try to use IComponentCallbacks2 interface and implement Application.OnTrimMemory to incrementally release memory based on current system constraints.
You could refer to Manage your app's memory for more information.
I have an app that is doing a lot of work related to Bluetooth connection and displaying graphs etc.
App is using many libraries as well. App has also a background service running all the time. Now I noticed that it is taking upto 500 Mbs of Memory Usage.
What I have done was commented out. Everything on app launch and just showed splash screen (custom made) and still footprints are 60-70 Mbs. That means something is taking too much memory without even using it.
One important thing is that Android Studio's Memory Monitor is showing me that app is using only 40-50 Mbs whereas my phone's Memory manager is showing upto 500 MBs. I have tested this on 3 phones. Result remains same.
Any help should be appreciable.
You are leaking alot of memory you can go to memory monitor in android studio and use garbage collector to have an estimation of the total amount of leak you're having.
Most of the time External libraries are main Issue for the memory leakage due to their differing implementations and are quite inefficient when used for work on mobile client.
Here is a great blog regarding memory leakage.
http://blog.nimbledroid.com/2016/05/23/memory-leaks.html
Use MAT Tool to find out memory leakage and resolve that.
Once started service, if it is no needed then stop the service using intent.
And also check you have started any timer thread and not stopped it.
So I have a Sencha Touch/PhoneGap + Crosswalk app whose Android startup duration I have struggled with for a while. Baseline, on first launch is around 10 seconds on a Samsung S3. After poking around and experimenting, I've learned some stuff about app launch time but don't know what I can do with it at the moment, or if there are other techniques to improve launch time.
So far, I've found:
That completely removing all images on the app (which totals ~20mb) reduces launch time to ~5 seconds.
That gutting the Sencha framework code (generated by "sencha app build package") on top of removing images reduces launch time to 2 seconds.
Gutting only my Sencha code, however, is negligible on launch time.
Clearly, messing with app size and core Sencha impacts launch time. I've done as much as I know to reduce app size (remove unnecessary images, compress images), and it's helped some, but not much. So I guess my main questions are:
Are there other notable ways to reduce PhoneGap app package size? Are there components that get added that aren't always necessary? The only other way I've seen is code obfuscation, but going from 40mb to ~37mb would have not much impact on launch time.
Is there anything I can do about how long Sencha seems to take to get fully loaded?
Am I missing anything else I can do to significantly improve app launch time? I've done a fair amount of research but haven't been able to find anything beyond basic package size; maybe I'm just using the wrong search terms.
Thanks! Any advice here would be much appreciated.
I have the following scenario:
An app for Android devices that has a few hundred classes. I am using Flash CS5.5, developing in AS3 using AIR for Android.
The app is a puzzle game and each class represents one of the elements from the puzzle. Each class is a derivative of a base class and only holds a few specific information like unique name, category, place in puzzle. Each class also has attached an 80 x 80 px image to it. However, there's about 300 classes like this.
The application runs very smoothly ONCE IT LOADS because it takes forever for the application to publish and then for it to run on the mobile device. I have no issue with the exporting/publishing time being high and the installation time on the mobile device being quite high. But each time I run the application from the mobile device, it takes some 2 minutes for it to load which is abnormally high, not even high-end 3d FPS games load for that long. Tests are done on a HTC Sensation running Android 4.0 and, subsequently 4.1.
My question is, what can I do to help reduce this initial startup time? I mention again, the app runs smoothly once loaded since it is really not that complex nor does it use a lot of graphics aside the many 80x80 JPG images attached to each class. In early testing, when I had like 20-30 classes only implemented, everything was smooth. When I added all the elements needed for the game after the game's logic was complete, everything was slow to load.
Thank you for any answers/suggestions.
If you want to speed up compile times for an AS3 project in Flash CS5.5, go into the Actionscript 3 settings for your .fla and turn off 'Warnings mode'. Warnings mode has a bit of overhead because it tries to give you helpful warnings when migrating code from AS2 to AS3. If you know what you're doing, you can turn this off and save lots of time.
1) File > Publish Settings.
2) Click the wrench icon next to 'Actionscript 3.0'
3) Uncheck 'Warnings Mode'
This cut doing compile times on a big project for me quite a bit. Another thing that helps is to divide up your assets into smaller swfs/swcs that are just brought in during runtime.
Only a partial answer, I'm not sure how to fix up a slow load time on an Android device. Good luck!
I am using a native code to capture the framebuffer using the link below
http://www.pocketmagic.net/?p=1473.
But my problem is that I want continous capture. Hence I am using service in Android so that it runs in background.
But my problem is that it gives low memory and dies after some time.
Then I tried with single activity and tried to capture the sam window many a times.
This time there is no problem even after 1000 counts.
The problem arises when there is service used.
Please help.
It is hard to say without seeing your source code - you should always try to include the smallest possible application that exhibits the problem behaviour.
At a guess I would say that you have memory hungry resources that are not being cleaned up and this is happening because your memory allocation and release code is not perfectly aligned with the life-cycle of the service. You could confirm this in a couple of ways:
Log the explicit allocation and release of memory and make sure your service is actually executing those parts of the code.
Use a memory profiler to find allocations that are not being released. This might be more challenging with native code than it would be in Java.