Attaching debugger - android problem - android

I am new to android application development. Whenever I run a new app, after it gets installed and the activity launches, it displays a message saying "application is waiting for the debugger to attach" on the emulator. After that, application runs properly. But I am not getting what that message is and how I can stop it from getting displayed. Could anyone help me...?

its normal... when debugging it takes some time to connect to device or emulator. Its not a error message and u need not worry about it.
Some applications(I assume not yours) needs to have permissions to debug, then u need to have this code
<manifest>
<uses-permission android:name="android.permission.SET_DEBUG_APP"></uses-permission>
</manifest>
In your manifest file .
or else have this
android:debuggable="true"
in the application tag in the AndroidManifest.xml
thanks

It means you run the application in debug mode to solve problems using the button shown on the screenshot.
Try the button at the right beside the debug button instead.

Related

Is there any difference in the app operation between release and debug versions?

I'm having a strange problem with my application. I made a very simple app to request car parts for a garage. The user (the garage's automobile mechanics) put the parts that he need in the app and a computer (that is in another part of the garage) receives the order and prints directly to a thermal printer. I send the data via an HTTP post, very simple, I just send the JSON to an HTTP address.
The problem is: when I run the debug version (via "flutter run" command on vscode) it runs perfectly, but when I generate the apk (via "flutter build apk") the app runs but it doesn't send the HTTP post (there are no error messages, the app just don't send and stays in the same screen forever). I have tested different devices, they all worked normally with the debug version, created and installed directly from vscode, and didn't work with the release app.
Why does it happen? Since the debug and the release apk have the same code shouldn't work the same way? Is there any way to see a log (some kind of debug, I don't know) running the release version?
This issue is most likely related to the permissions. Please check if your AndroidManifest.xml file in Android > app > src > main directory has the following permission:
<uses-permission android:name="android.permission.INTERNET"/>
If the permission isn't present, add it above the line that starts with <application:
<uses-permission android:name="android.permission.INTERNET"/> // Add here
<application
android:name="io.flutter.app.FlutterApplication"
The solution posted by Joao Soares worked, but i still have a question: why?
Is this the standard behavior of the app? The permission to use the internet is really off by default? I can't see a reason for this...

Android Studio Emulator E/AudioFlinger error message

When I start any device from the AVD Manager it just loops this error message infinitely:
E/AudioFlinger: read failed: framesRead=-1
It even does that when I create a new device. Doesn't matter if "Use Host GPU" is enabled or not.
When I start my application it would usually start up right after the emulated device started up. Since this error message appears it does not start my application automatically (the app can still be started manually though).
Anyone else had any experience with that and maybe a possible solution?
EDIT 1: It stops looping the error message as soon as i hit the app button. Seems to just occur on the home screen.
Open Google Settings app > Search & Now > Voice
Here you need to turn off "OK Google" Detection. It may be grayed out and disabled with mark "Retrieving settings...". To make it enabled, just change the language to any other one in the field above it. If selected language is unsupported for "OK Google" detection, the switch inside this menu will be also grayed, it fixes the problem as well.
I have the same problem, and if I don't stop it, Logcat will "say" "Too much output!" and if I still don't stop it, I get prompts to send an error report to Google, even freezes.
I finally learned to put a strange set of characters that can't possibly be displayed by an error message (I use "~~~~~") and put the same string as the first argument of my Log statements and all I see are my own messages. Of course this means I don't see errors, especially Exceptions, so I just put Excep after the string "~~~~~" and delete them one by one (otherwise, here comes the deluge again).
make sure you have audio permission in your manifest:
<uses-permission android:name="android.permission.RECORD_AUDIO" />

Android application lacking debug information in Android Studio

I'm trying to debug an application that I'm writing using Android Studio but I can't seem to get any useful debugging information out of Android Studio's "Debug" view. I'm launching my application with the bug-looking "Debug" icon but the "Debug" view doesn't have anything useful (no stack frames from my application, for example):
Even if my application crashes I don't get any useful information. As I recall, the ADT plugin would automatically drop you on the line that caused the crash.
Do I need to do anything else to make my application "debuggable" in Android Studio? I've also tried forcing android:debuggable="true" in my AndroidManifest.xml but to no avail. Android Studio does seem to be attaching to the running process (the app shows the "attaching to debugger" message for a few seconds when it first launches).
There are some things to check:
If your app-debugger is working and stopping on normal breakpoints, maybe you have to set an exception-breakpoint:
Open Debugger
Press "View breakpoints"
Usually, there should be a breakpoint called "Any exception" with checkboxes on "Caught exception" and "Unchaught exception". If not, add an exception breakpoint yourself and specify the type(s) of exceptions you want the debugger to stop on (you can use wildcards in the exception-classnames, e.g. *Exception).
If your app-debugger is not working, check the following options:
Check if you have enabled USB-Debugging in the developer options of your device
Check if you have authorized the computer as a development machine in the developer options of the device (if unsure, clear the authorization-list from the developer options page and reconnect the device)
Check if your development machine has only one adb-server-process running in the background (if more, kill all of them with a process mananger and restart with "adb start-server")
Add "debuggable true" to your debug-buildType in build.gradle:
buildTypes {
debug {
debuggable true
}
...
}
If your app-debugger is still not working, restart your computer and re-install adb-drivers for your device. Make sure there are no conflicting drivers active with more than one connected device (maybe connecting only one at a time).
Note: even if you got exception breakpoints working, they might not be useful at all, depending on the type of the crash. Most of the times, you will get the debugger stopping in the Zygote-exception handler where you don't get much useful information or stacktrace.
In such cases, it is the easiest to just let the debugger resume or reproduce the crash without a debugger, and check the logcat-output for a stacktrace in the ERROR-loglevel of your app's logcat-output. Those stacktraces should have clickable line-infos thus enabling you to set a normal breakpoint on a relevant line of code in your app's source code to analyze the problem.
After updating Android studio this problem went away. Not sure what the issue was.

LogCat is not showing null pointer exception

My LogCat is often not showing null pointer exceptions..
Sample:
ProgressDialog pd;
ps.show();
Application stops (do not reacts for any action), but there is no information about any reason in logcat.
Another sample is with database - if there is no DB and I'm making actions on it, the same happens.
I tried (that action with DB) on my colleague's phone and there was normal error. I have all needed programmer options in my phone turned on.
Maybe someone know , why it is so? It was not burdensome, when I had small app, but now when it's bigger, it can be really frustrating.
I get this with android studio too...
Close android studio, restart ADB, and generally it starts working for me.
If that does not work then put a breakpoint at the line .show(); ... Then open up the logcat and then skip over the breakpoint. It then shows, I have similar issues.
(Windows 7 64 bit - Android Studio 0.82)
I dont like the IDE logcat option honestly.
The SDK comes with an adb binary, use the logcat option from there via
adb logcat or my personal favorite built in alias, adb lolcat
This will give you the log information for EVERYTHING happening on the device, and can be useful tracking down issues caused by device state.
For example, you can see network changes in the logcat, and if your app crashes on network call you wouldnt have any idea why if you just used the logcat output from your app.
In my case I was using: Thread.setDefaultUncaughtExceptionHandler in my application file. If that is not turned off during debugging you won't see any exception output. ( Just make sure to turn it back on again when you release so you can still handle your issues ).

Debugging not working in a service class ?? what can cause this issue?

All of a sudden I am not able to debug anything that i am doing in a service even though i put breakpoints all over. but logging shows that all the lines are getting executed. Can someone tell me what could be causing this issue. I am using eclipse and i have set to "Build automatically".
Do you have an Activity which is launched at the beginning of your application?
If not you have to manually activate the debug on your process by using the DDMS tool in Eclipse.
In DDMS -> Devices, check your process (the line contains the package name of your app), select it and then click on the debug button. A debug icon will appear near your process, then you should be able to use breakpoints in your Service.
If you are using a Runnable try placing this in the run() method:
android.os.Debug.waitForDebugger();

Categories

Resources