Huawei, logcat not showing the log for my app? - android

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)

Related

Android: Experiencing "silent" crash when opening Developer Options programmatically from application

I'm experiencing a "silent" crash when Attempting to open the Developer Options programmatically with
override fun openDevelopmentSettings() {
val intent = Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS) //Silent-crashes the app on my phone, but not emulator. What?
startActivity(intent)
}
Opening the About Phone Settings however works perfectly fine when replacing the above param with Settings.ACTION_DEVICE_INFO_SETTINGS
Setting Android Studio's Logcat panel to Error and No Filters produces the following, where the About Phone Settings produce no errors:
2021-04-12 20:43:03.576 1586-2265/? E/UserRestrictionsUtils: Unknown restriction queried by uid 1000 (com.android.providers.settings et al): null
2021-04-12 20:43:03.577 1586-2265/? E/UserRestrictionsUtils: Unknown restriction queried by uid 1000 (com.android.providers.settings et al): null
2021-04-12 20:43:03.592 15832-15832/? E/ndroid.setting: Can't find memory status under: /sys/block/zram0/
2021-04-12 20:43:03.641 674-9189/? E/libnos_datagram: can't send spi message: Try again
2021-04-12 20:43:03.662 674-9189/? E/libnos_datagram: can't send spi message: Try again
2021-04-12 20:43:03.745 15832-15832/? E/BtHDAudioCtr: Active device is null. To disable HD audio button
2021-04-12 20:43:03.854 15832-15832/? E/BtHDAudioCtr: Active device is null. To disable HD audio button
2021-04-12 20:43:03.864 15832-16203/? E/ndroid.setting: Can't find memory status under: /sys/block/zram0/
Please note that the Developer Options menu does open, just my application's process crashes upon opening. Clicking the back button from the Developer Options relaunches my app instead of resuming as the process is dead.
I have used another app that also programmatically opens the Developer Options and do not experience the crash.
I have tried both debug and release builds.
I have also tried wrapping the code in a try-catch block, but when debugging the catch block isn't hit.
I unfortunately don't have another physical device to test on, but an emulator of the same device and API level doesn't reproduce the crash. What's going on here? Is my Pixel 3 at Android 11 (RQ2A.210305.006) corrupted? Memory error? Any help is greatly appreciated, thanks.

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?

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".

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

Hello World Tutorial - Using the Debug Perspective

I've just started going through the tutorials but seem to be having some trouble with the following portion:
"Run > Debug History > Hello, Android from the menu to enter debug mode. Your app will restart in the emulator, but this time it will suspend when it reaches the breakpoint you set. You can then step through the code in Eclipse's Debug Perspective, just as you would for any other application."
when I follow these instructions I see a list of warnings like this...
[2010-11-24 15:39:43 - ddms]Can't bind to local 8617 for debugger
and finally this...
[2010-11-24 16:08:25 - HelloAndroidWeb] Launch error: Failed to connect to remote VM. Connection refused.
I've never used a debugger before but from reading the tutorail I expect a new window to open (the Debug Perspective), but this is not the case. Have I dont something wrong in during installation/setup.
Thanks
Is the application running on the emulator or an attached device? If on a device, USB Debugging mode needs to be enable through the setup menu. If in the emulator, you may have to restart it in order to reattach the debugger (ADB).
In the 'Devices' panel do you see the list of active processes running? Can you select your application and click on the 'Debug select process' icon?
Is debbing set to true in your manifest?

Categories

Resources