Enable DEBUG logging on Blu R1 HD (Amazon phone) - android

I bought the Blu R1 HD, Amazon's Android phone, for use in dev testing. When I view its logs via logcat, only messages logged at the INFO level or higher are showing up for both my app and other system-related messages.
Yes, developer mode is enabled and ADB Integration is enabled via Android Studio. The same app installed on other devices or the emulator shows the DEBUG and VERBOSE log messages as expected.
I see that some specific phone manufactures have default settings to suppress log messages at runtime, e.g.
Huawei, logcat not showing the log for my app?
Perhaps the Blu phone is doing something similar. Does anyone know of a way to get DEBUG and VERBOSE logs to show up on this particular phone? (It is the low-end version, 8GB storage, and shows Amazon ads on the lock screen.)

Daniel, its probably the same exact instructions..
dial
##2846579##
you should see a hidden menu:
Go ProjectMenu / Background Setting / Log setting
change the log setting than reboot phone

I have a more recent BLU Vivo 5 phone and I noticed that only some of my logcat messages were showing up. After some more experimentation I discovered that the tag names I was using were somehow being filtered. For example, if I do some logging like this:
public class MyClass {
....
...
public void test() {
Log.d("MyClass", "Test log");
Log.d("MyClass1", "Test log");
Log.d("TestTag", "Test log");
}
Only the second and third log statements will show up:
05-31 18:35:48.812 7294 7294 D TestTag: here
05-31 18:35:48.812 7294 7294 D MyClass1: here
On the BLU phone, it seems like there is a tag filter that blocks log messages with tags matching certain criteria.
I'm sure there is a proper explanation but for now, in my app, to get the logcats on the BLU phone, I just simply add an extra space to my tags like so:
public class MyLogger {
public static void d(String tag, String msg) {
Log.d(tag + " ", msg);
}
}
Btw, just to clarify, I did not have to enter any special # codes in the phone dialer to get log messages to show up. The logcats just show up by default.

Related

Sony, logcat not showing the log for my app?

Logcat is showing all logs: Log.i(), Log.e() but not Log.d().
If I switch to another device such as my Reami 3S then for the same app log is displayed.
Sony is runngin Android 6 and developer options is turn on.
I found my answer where people used secret code for USB control menu, but I can't found for Sony E5 (f3311).
Pls, help me. This logs need me for logging retrofit. Without it I can't show HttpLoggingInterceptor.
You should activate the maximum log level in your device, in the answer below one of the solutions is
Dial
*#*#2846579#*#*
and you will see a hidden menu. Go to the Project Menu > Background Setting > Log setting and define the log availability (log switch) and level (log level setting).
Source: Huawei, logcat not showing the log for my app?

Debugging with broken charging port

I'm designing an android app, however the charging port on my phone was damaged and when I connect the computer to my phone, it says USB device not recognised. I have looked up debugging through bluetooth and wifi, however they either require a root, which needs me to connect my phone to the PC or they need that connection to set up the bluetooth/wifi debugging at first. I've been trying alternatively to use the emulator, however after fixing errors with the intel hardware acceleration, I now get a black screen whenever I launch the emulator. I would like to be able to debug on my phone, is there any workaround you can suggest that would work in this situation?
This may not be the best solution but it will let you grab logs from the device.
1. Enable the developer option on your phone if you have not done it already.
2. Enable "Bug report shortcut" or "Include bug reports in power menu" under developer options in settings. This will let you send an email with device logs attached to it.
3. Add whatever logs to your application and install it on the phone.
4. Run the app.
5. Send the logs in email using the option in power button menu.
6. Go through the logs. Go to step 3 until you fix the problem.
The .apk file may be easily transfered using Dropbox or any other filesharing service. Pick it up in the build outputs folder.
However this is not the best way to debug your app, one way of doing this would be to implement your own Log wrapper and to write your output to the file on an external storage.
A quick example would be:
public class Log {
public static int v(String tag, String msg) {
writeToLogFile(msg);
return android.util.Log.v(tag, msg);
}
public static int d(String tag, String msg) {
writeToLogFile(msg);
return android.util.Log.d(tag, msg);
}
private static void writeToLogFile(String msg){
// write to log file
}
// TODO: implement I / W / E levels logging
}
Also, how about using Fabric kit for troubleshooting.

Can I Use e.PrintStackTrace() or Breakpoints When Using Android USB Device?

In the Android app I'm currently working on I have all my try/catches to print out a stack trace but when using a physical android device via USB these errors do not seem to get printed. Further more, when I attempt to create a debug log on the device, it never shows up. My assumption is that I have to start relying on Log.d and print everything to the logcat. Is this correct?
Edit: I should also mention that these stack traces appear when using an emulator as well.
Also, I have noticed when debugging on a physical device when I hit break points it locks the application but it does not allow me to continue with debugging, a.k.a pass over the break point. Is this an error or simply how it preforms? Break points work fine on the genymotion emulator.
You are doing something in wrong way, be sure not to debug and look for logs at the same time and be sure you are using right filter at loging.
And at last be sure that you turn on debug mode on at your release version of app(or what version you are using at device).
For the logs, you should have to check is the log is enable, by using the following steps in eclipse:
* Go in Windows -> Preferences.
* After that, select Android -> LogCat.
* And set the option "Show logcat view if message priority is atleast:" to "VERBOSE".

Huawei, logcat not showing the log for my app?

OK, logcat is showing system logs but it is not showing application log on my Huawei Ascend. If I switch to another device such as my Galaxy Nexus or Nexus 7 then for the same app (same APK even) log is displayed.
The Huawei Ascend is running Android 4.1.1, it has USB debugging switched on in developer options. This occurs for logcat run from either the command line or from IntelliJ. And I'm making sure that the correct device is selected - in fact I'm only plugging a single device in at a time. I've tried restarting adb, clearing it's buffer etc
I can see that the app is starting on the Huawei, I even get system logs showing that the Activity has started. But unlike on the other devices I get no app log in the Activity#onCreate (or from anywhere else).
08-08 20:55:44.050: INFO/WindowManager(431): Switching to real app window: Window{41ae8780 au.com.xandar.wirelesstiming.timekeeper/au.com.xandar.wirelesstiming.timekeeper.TimeKeeperActivity paused=false}
08-08 20:55:44.180: INFO/ActivityManager(431): Displayed au.com.xandar.wirelesstiming.timekeeper/.TimeKeeperActivity: +387ms
How can the application log not be getting delivered?
OK, since I had another Huawei Ascend I ran into the same problem. This time I have the exact answer. Follow these instructions (from denispyr's answer on Why doesn't logcat show anything in my Android?)
Dial
*#*#2846579#*#*
and you will see a hidden menu. Go to the Project Menu > Background Setting > Log setting and define the log availability (log switch) and level (log level setting).
And then make sure you restart your phone.
Please note this probably only applies to Huawei phones.
Also note that if you're on a Huawei tablet (e.g. MediaPad M3), instead of dialing, you launch the Huawei Calculator in landscape and enter ()()2846579()().
For Huawei with Android 8.0+
we must dial the code: *#*#2846579#*#*
and selecting the option AP Log will be enough to display the messages in the LogCat.
If any one having Letv Phone (LeEco Le Max 2 or 1) above solution won't work. Try the below USSD. Fig.1 for reference.
Press Dialer *#*#76937#*#*
Select "Enable All Logs"
Instead of using
Log.d(TAG, msg);
Try this.
Log.wtf(TAG, msg);
work for me.
I have a HUAWEI Y3 II aka LUA-L21.
The accepted answer didn't work for me.
It led to some MTKLogger settings screen, which is different than described in the answer, and didn't help at all.
My solution
Dial *#*#2846580#*#* (please note this code is different from the one in the accepted answer)
You just entered a settings screen called EngineerMode (again, different from accepted answer's ProjectMenu)
In the first Telephony tab, click the Log Control item
Activate both switches (set Mtklog control to catch all log and adb radio log to catch radio log by adb)
Back in the previous screen, swipe to the Log and Debugging tab
Open Debug Utils
Change Debug Level from User Mode to Engineer Mode
For good measure, restart your phone
Screens
Changing Log control
Changing Debug utils
Additional notes
Just to clarify my original problem; logcat was showing some of my app's log entries, just not my own messages - I saw entries belonging to my process com.example.myapp, but never anything I was printing out myself, in my code, using Log.d("TAG", "hello world");
There was plenty of stuff like this:
4260-4270/com.example.myapp I/art: Debugger is no longer active
4260-4412/com.example.myapp I/System.out: [CDS]rx timeout:1
4260-4412/com.example.myapp D/NativeCrypto: doing handshake ++
4260-4603/com.example.myapp D/OpenGLRenderer: Flushing caches (mode 0)
4260-4603/com.example.myapp D/Surface: Surface::disconnect(this=0xb85285d8,api=1)
4260-4260/com.example.myapp D/ActivityThread: ACT-STOP_ACTIVITY_HIDE handled : 0 / android.os.BinderProxy#2333cbdf
...but never anything like this:
4260-4603/com.example.myapp D/MainActivity: hello from onCreate!
The above steps solved the issue for me.
Some newer versions of Huawei Phones (I am using a Y9s 2019) have some settings changed.
Process is now
Dial *#*#2846579#*#*
Background Settings -> AP LOG Settings -> Open.
If you still can't see the logs, restart both your phone and Android Studio/Eclipse
Open your Dialer app and enter the following code: *#*#2846579#*#*.
1-Enter the Background Settings page.
2-Click on “Log Settings”
3-Check all 3 options to enable full logging.
4-Ignore the "will affect performance" warning.
5-Reboot the phone.
Try downloading a Logcat app(eg aLogCat) on your device itself and see if you are having the same problem.
I know its not a complete solution, but this way you may be able to figure out whats going wrong by reading the application logs.
Try this:
In Eclipse editor:
Reset adb from windows-->devices and then try again ...
please check your project is highlighted with green color (simply select your projrct name)

What to do when app crashes and logcat shows no errors

The app works fine in the emulator, but after installation on a phone, it crashes every time on launch, and logcat shows no errors.
What am I supposed to do when something like this happens?
My Suggestion for easier resolution of your problem :
Run the app from the eclipse in debug mode on the Phone . It will make it run on debug mode. You will most likely get more debug output.
Turn on ADB in the phone.
Connect the Phone to the PC
Run as "Debug Configuration" from eclipse.
It should run from your phone and Eclipse will ask for your choice for first time before running that.
Turning the Debug Mode on ( Note : This isn't the 'ADB connection' we are referring to ) , It will enable further logging of the application and doesn't do garbage collection normally.
( You will notice a 'Waiting for debug connection' dialogue , if the applications are forced to work in debug mode ).
For e.g :It makes the Async threads keep running and doesn't stop running. Crude and irrelevant for your case . But just as an example.
So , Since the Applications in the phone are forced to run in debug mode , it will get the logcat with detailed errors down to the specific threads.
However, the debug mode is better used when it's used in conjunction with "Debug As" run configuration from Eclipse. And keep in mind that it will automatically turn on that debug application mode ( And there by the dialog box also) , the logcat will show you more details and plus it will break-point at the errors which occur ,in their sequence of occurence.
Regarding what Ares told,
When you want to do the debugging of a process directly,
You can go to the DDMS panel in Eclipse,
On the right side tab menu Devices ,
Select the process you want to debug . and click on the green symbol ( Says, Start Debugging process )
It will automatically go to the source when it breaks if you have the source code in that eclipse work-space.
Additional hint:
On huawei phones, logcat doesn't show debug messages and excpetions, if the phone is in default system settings.
In order to enable logcat full logs on Huawei phones, you must do the following:
Open the factory settings menu by dialing *#*#2846579#*#*
Navigate to Project Menu / Background Setting / Log setting
On older phones: define the log availability (log switch) and level (log level setting).
On never phones: tick AP Log (which seems to enable app logging in general) and CP Log (seems to enable debug logging)
Close the menu with your backbutton (no restart needed)
Source: https://stackoverflow.com/a/18395092/1075072
Install a tool like AndroidSystemInfo that can show you the logfile on the phone - even when you are away from the host computer.
It is pretty unusual that Android leaves no trace whatsoever.
Does your app perhaps require features that the phone does not have (e.g. a camera or gps or nfc)?
In Eclipse you should go to DDMS, then click on device's name or android.os in Devices panel. And turn your device in debug mode.
Put your own logs to track what block of code cause crashe, or just debug it.
You can reset adb (In Devices -> View menu -> Reset adb)
Click on the selected online device/emulator to show the logcat
Disconnect the cable and again connect it. (Or restart the emulator)
Restart Eclipse
I restarted my emulator and cleaned my build. This got rid of both the non-logging and the spurious crash I was having

Categories

Resources