debugging Android apps? [closed] - android

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am now trying to improve my programming skills and specially I would like to now how you debug those situations where the app lags a bit. I tried to move most of the critical parts to threads but still I get some ANR. I guess my app is leaking memory somewhere.
So, how to debug this?

I think you should spend some time reading this http://developer.android.com/reference/android/os/StrictMode.html
From Strict Mode reference page:
StrictMode is most commonly used to
catch accidental disk or network
access on the application's main
thread, where UI operations are
received and animations take place.
Keeping disk and network operations
off the main thread makes for much
smoother, more responsive
applications. By keeping your
application's main thread responsive,
you also prevent ANR dialogs from
being shown to users.

Take a look at Traceview
It's now even included in the eclipse android dev tools plugin.

Related

App is Lagging/Hanging. Why? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I made a simple profile in my android app and after uploading image to firebase storage my app is lagging in speed, the image uploaded is in KBs size and in my profile I am using a Navigation Drawer whose sliding animation is also hanging. I am unable to figure out whats going wrong.
Maybe your are using the Main thread for doing all the job. This is one reason for UI thread to hang(i.e) the app didn't hang but it waits for the main UI thread to complete its work.
Generally, the app hangs for this reason. As suggested by Commonsware track methods. Also, try using background threads instead of main thread.

How are built in Android applications so small? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I've been working on a relatively small Android game app recently and after much optimization I can only get it down to use 20-30mb of ram. I was curious as to how some Google or Android apps can use so little ram. For example, on my S4 the music app rarely, if ever, uses more than 6mb of ram, even though it plays music and displays many album artworks.
The android developers website has a dedicated page for this issue. For memory optimizations I can think of the following points:
Re-use objects
Avoid static variables as easy work around as they cannot be garbage collected
Optimize your Bitmaps images contribute to a lot of RAM usage
Dont hold on to objects after they are not needed

Why does not allow network access in the main thread of a process in Android? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
can you explain why does not allow network access in the main thread of a process in Android?
If anybody can explain. Its will be helpful for me.
Because the main thread is responsible for all the UI (user interface) operations (it is also called the UI thread). Everything related to displaying stuff in the screen is done by it. So if you occupy the main thread with long operations such as a network operation, you will experience jitter in the screen and even ANR errors (Application Not Responding). In more recent versions of Android you will not even be allowed to do that as the application throws NetworkOnMainThreadException.
Till Donut it is used to create multiple threads from 1.6-2.3 that you was using before but if now you are using 3.0 or above then it is used to create single threaded model by using AsyncTask otherwise you ll get the NetworkOnMainThreadException.

Should I keep Android Bluetooth Server Thread in Service or Application? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I want to keep the Bluetooth Server Thread alive as long as the Android Phone is on.
Should I manage the thread in Service or the Application?
Service, Application, Which one live longer?
I'm not entirely sure what you are referring to when you say Application. An Application can be comprised of one or more Services and/or one or more Activities. From your description, though, you want a background Service.
Edit:
As far as a Service getting shut down, that is always a possibility. If there are clients bound to your Service, it is highly unlikely that the OS will shut it down.
If you believe your Service absolutely needs to be running at all times (which is not likely given proper design), the only thing you can legitimately do is run it as a foreground Service. Even then it may be shut down under "extreme memory pressure" (see Process Lifecycle).

is it possible to run multiple apps on android at the same time? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want to run many apps on the same emulator at the same time. Then get the i/o streams of these apps, and allow them to be controlled to through web browsers, or an applet.
Is it possible?
Basically, I want to build a similar service like Amazon that allows user to see apps running on emulator through browser. Now, if only one activity is shown on the screen at a time, I would need to create a emulator for every user. That wouldn't be feasible. So I need a workaround. And if multiple apps could be run on emulator and their I/O could be programaticaly handled, it would solve the problem.
You can't do what you want to do. In Android, you can run several applications at the same time, but only one at a time will be on the foreground (visible to the user). But yes, you can have several applications running in the background syncing, downloading data, logging stuff, etc.
For what you want, you might consider using live android project as it is a much lighter solution to run.
It seems the one Pedro Loureiro posted is about to (or is already) stopped production. Right now the best program for this job would be this: link.
Yes, that's why you also have task killers.

Categories

Resources