I want to track the native heap in my application.
I opened DDMS from /tools sdk's folder, as I saw in tutorials, and I do see the
"Native Heap" tab.
However when I press the "Update heap" Icon, the native heap is still empty - I don't see
any information there.
Tried that on two devices, one of them is rooted.
How do I solve this problem?
thanks!
Screenshot:
I had faced the same issue and manage to fix using the emulator. I had to put a file in /data called local.prop with libc.debug.malloc = 1. Than I had to close and start the emulator again. Probably it could work with the rooted mobile too (I am taking a guess).
May be http://bricolsoftconsulting.com/how-to-enable-native-heap-tracking-in-ddms/ can help... I tried and succeded with rooted phone as well as emulator.
Related
I have used Eclipse to write apps for android multiple times without issue but I am now trying the new Android Studio which I like but here is my problem.
When I run the app I pick my AVD and then tell it to start. The emulator starts loading and then says paired. Then it starts telling me to swipe up and left and right to display and remove cards. Then it says to put hand on screen to dim the screen, ok well I'm on a MacBook Pro so that don't work I swipe to get past that part sometime I can others I can't. Next it says to touch the clock and say some words which also can't do on my Mac, and that is where the emulator stay it never goes to a home screen and it does this no matter what AVD I choose. How can I get the Emulator to just plain open to the home screen like it should.
Thanks for any help.
In your AVD Manager, edit your AVD and make sure your Target is "Android L" and not "Android X.XW". The "W" stands for "wear" and that is causing your issue.
Alright I figured it out. I remember having a similar problem recently when I was taking an android development class for college using eclipse and sure enough that was it.
So here was the solution eclipse gave same problem. for some reason if you have caught exemptions such as hard coding a string etc. the emulator will not run till you ignore these exemptions or fix every last ! mark in your code. Once you do this the emulator will load and run properly.
I also had the same problem with my AVD. The Android Emulator window just used to pop us and the green bars flowed infinitely. After lots of trial and error I arrived at a solution for my problem. the problem was with the Heap size and the RAM size.
Initially the default heap size was 128 MB and RAM was 1563 , I just changed the heap size to 512 MB and reduced the RAM size( high RAM was making my PC run slow) also I enabled hardware acceleration. And Yipeee, it worked.
I've noticed Android Studio (when running) uses greater than 100% CPU at all times, even when it appears there are no background processes that the IDE is running (indexing, etc). I might suspect this were something specific to my box, but some fellow developers are encountering this as well.
Often times the CPU usage is in the high 100s or mid 200s (see screenshots below). Has anyone encountered this as well? If so, are there any strategies or options within the IDE to correct this intensive use of system resources?
Thanks to Buzzrick (answered on this page, probably above my answer), he mentioned about VCS. Turning off all of the background operations of VCS seemed to have a HUGE impact toward the high cpu usage - it was 150% and now it's 20%, more or less.
I'm on OS X
Go to: Preferences > Version Control > Background. Now listed under 'Background Operations' are 6 options.
I disabled the first three options which are:
Perform update on VCS in background,
Perform commit to VCS in background,
Perform checkout to VCS in background.
You can try the following options in the File Menu:
File Menu -> Invalidate Caches / Restart... -> Invalidate and Restart
Enable Power Save Mode by clicking on File -> Power Save Mode
Power Save mode only disable code insights and background tasks.
You might consider going to File > Invalidate Caches / Restart
Your cache might be kicking off something funky in the background
I encountered a constant high cpu usage with no apparent reason. Invalidating cache did not work nor did the power save mode.
In my case there was a something wrong in the '.git' directory which was causing android studio to fail in an endless loop. Checking out the repo again fixed the problem.
My advice is to check the android studio logs for any hints to what is causing it to falter. You could also start it from terminal and check the Stdout/Stderr output.
I switched on power save in Android Studio 1.0 it helped but this meant I opted out on so many features that Android Studio has to offer. Thus I sought to find a better solution, I happened to always have a dialog box pop up and ask me to increase my VM size. Apparently once I increased this, I am able to switch off power save and have my Android Studio work perfectly.
This is how to do so:
On Mac OS go to /Applications/Android\ Studio.app/Contents/bin/studio.vmoptions (To open contents right click on Android Studio app > View contents)
You will find the following variables
-Xms128m
-Xmx4096m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=200m
-XX:+UseCompressedOops
On Windows go to Environment Variables and find a System Variable called _JAVA_OPTIONS
Increase these figures accordingly.
Xmx specifies the maximum memory allocation pool for a Java Virtual Machine (JVM).
Xms specifies the initial memory allocation pool.
i.e Your JVM will be started with Xms amount of memory and will be able to use a maximum of Xmx amount of memory.
I had exact same problem on Linux. Solved by increasing the memory size.
Started by looking at the top -p <android studio pid> -H which shows which threads are using most of CPU, to me there are three threads: 94232,94233,94234. Then I do a jstack <pid> to get the stack dump of android studio, and look for 0x17018 (=94232), it turns out to be "Gang worker#0 (Parallel CMD Threads)". All three of them. apparently JVM is too busy doing GC all the time.
Also opened jconsole against my android studio process and it shows GC time "20 minutes"!!! (at the bottom of memory tab)
Fix is to change the studio.vmoptions (or studio64.vmoptions in my case), to increase the -Xmx value from default 750m to 1500m. It is sufficient for me. if you have too much memory, set to 2g or 4g or 16g..
Interestingly, for me this seemed to be something to do with the version control integration.
I fixed this by re-loading my android studio project and when it asked about wiring up my CVS links (I don't recall the exact wording), I just said "Ignore". After that it ran smoothly without pulling CPU
I tried the following procedure and Android Studio on my Surface Pro 3 sped up by an insane amount:
Reduce the amount and memory of the Android Virtual Devices you have.
Invalidate Caches/Restart
Go to Power Save Mode
Close all unnecessary files that are opened.
Reduce your VM Heap Size to around 256.
On Windows I reduced the studio64.exe process priority and set the process' affinity to half of the cores.
Open Task Manager, click on Processes tab, right click on process studio64.exe and you'll see it in the menu.
I've left this question open for awhile as coworkers and posters here have found value in various solutions over time. For myself, simply updating Android Studio solved the issue (after a number of months where none of the solutions herein worked for me).
In my case I have white-listed Android-Studio's folder in "Eset Smart Security" and the problem solved!
hope this helps!
Edit:
Disabling HIPS in Eset settings was also helpful in my situation!
You can check which part of Android Studio or which plugin is using a lot of CPU, with Android Studio -> Help -> Diagnostic Tools -> Activity Monitor
On Android Studio 2.3, this used to happen when the "Android Monitor" window was open (the window shows Logcat messages from devices and emulators), and then you press Ctrl+F (Cmd+F on the Mac) to reveal the 'Find' search bar inside this window.
It can also happen when you connect a Samsung phone to your computer via USB, which has Developer Mode enabled, because Samsung phones usually send out large amounts of debug text to Logcat every second, even if the Logcat window is closed.
So the solutions to prevent the 100% CPU usage are either:
Turn off the Find search bar, or hide the window completely. Or ...
Disconnect a Samsung phone which is sending out lots of debug messages. Or ...
Upgrade to Android Studio 3, where this bug doesn't happen. Or ...
If all else fails, just restart Android Studio
Hi!
I have a problem getting my android emulator to work. After i run my android application project, the emulator starts, but instead of showing my application, it says the following : "Power off. Shutting down..." and then the screen goes black. I'm unable to launch my application or do anything in the emulator.
What might be the problem? My target SDK is 1.5, and the device i chose is Nexus One. Thank you
did it work before?
did try to wipe user data? (avd-launch option)
//edit:
I think Fuad is wrong:
if you change the ramSize to 1024M or 1024MB, the virtual device's amount of RAM is just set to 256MB
I had problem at first some thing like this for using android SDK...check this maybe helps you :
(YourWindowsDrive)C:\Users\YourLoginName(mine is Fuad) \ .android\avd\App.avd(This App.avd is a folder the name what I have used for my avd)
then in folder U see "config.ini". open it and change "hw.ramSize=1024" (mine is 1024 and maybe yours is different) to :
hw.ramSize=1024M
I am beginning android development using the latest versions of the android SDK and eclipse. I have followed the Hello Android Tutorial
and used every combination of targets available but the Emulator freezes on the load screen with the flashing "android" title.
I have checked the other related question and DID wait about 15 minutes. but still no change. Any help with this would be great. Thanks.
I had a similar issue, and still do sometimes today. Have you tried deleting the AVD and then re-creating it?
Also try changing some of the AVD's values, give it more ram, larger SD card. You can do this through Window > Android SDK and AVD Manager > Edit the AVD, and then add values / modify the SD card size.
EDIT: Also - just for reference, I have a Intel Core i7 with 16gb of RAM and AVD's STILL take forever to load.
EDIT: Another handy thing to know is that if you check the "Snapshot" option when editing the AVD, it will save the last state and load that instead of a full [slow] boot. Kind of like putting your computer to sleep.
Adding values / modify the SD card size may be better .
Try not to close the Android Emulator , to avoid re-open .
Yah android emulator takes time to start up, but it should start within 2-3 mins. Check your RAM and processor. The RAM must be atleast 1GB (preferably more) to speed up loading emulator.
When i run the emulator is running up to the process big text android. After that is not responding. In Eclipse console showing text "Wait for Home" I tried re-install of android also
My System properties Microsoft Windows XP, 0.99GB of RAM
Any help me for this problem Advanced Thanks
The emulator takes a long time to load the first time, several minutes, and in this time only shows 'Android' in large text. Wait a couple of minutes and then you should be fine.
Make sure your SD card file is large enough. I've found the minimum Eclipse enforces (9MB) isn't enough for it to boot.
You may also have to use a different computer or upgrade your RAM. Modern phones have around 500MB RAM, so .99 GB maybe not be enough to go around for Eclipse, Windows XP, and the emulator.
As a last resort, you could reformat. I was having a similar problem and it worked after reformatting.
Don't rush to reinstall the SDK. Try creating a new AVD with the same API level that your original one had and run your app on that one. If that's OK just delete the original one as its image may be corrupted. You won't lose anything and it's not worth spending time on trying to fix it.
Edited:
The solution which worked for me is, when you get the message
Waiting for HOME ('android.process.acore') to be launched...
wait for few seconds and then right click on the project and click run as android application once again.
I once had similar problem. This solution worked for me. When I launch the emulator, I chose wipe user data option on the launch options window. Hope this help.