问题
I am new to Android development and bought a cheap Huawei Sonic (U8650 apparently) so I could test my first attempts at making an app on an actual device.
However, whenever I try to use 'adb logcat' or 'adb shell' then 'logcat' on the device I get:
Unable to open log device '/dev/log/main': No such file or directory
I have already enabled Usb debugging in Settings -> Developer.
I just don't know enough about Android to know if this is something I can even fix.
I have found two other questions with similar problems:
/dev/log/main not found
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Unable to open log device '/dev/log/main': No such file or directory
...but they both turned out to be using some kind of non standard kernel that had logging disabled. Mine is a stock phone out of the box.
It's a very cheap but snappy Android 2.3 phone, so hopefully it wasn't a total waste of money.
Any help would be greatly appreciated.
回答1:
Dial this: *#*#2846579#*#*
Service menu will appear.
Go to "ProjectMenu" -> "Background Setting" -> "Log Setting"
Open "Log switch" and set it to ON.
Open "Log level setting" and set the log level you wish.
Reboot the phone.
回答2:
- Open:
/system/etc/init.d/×××
(not the same file on different ROMs, find the right file) - Find the line that says:
rm /dev/log/main
- Change the line to:
# rm /dev/log/main
(comments out the line,rm
= remove, in case you were wondering) - Save and reboot
回答3:
I'm sharing my case and solution:
My cellphone had a jellybean version oriented to performance (To be exact a Slim Bean ROM) with a Semaphore kernel (You can recognize it because when the cellphone is starting, the semaphore logo is shown). These kind of ROM have by default disabled the logging so I had to download the Semaphore Manager application (You can download it from here). After that, in the section "Modules" I had to turn on the Logger option as it is shown in the picture
Restart and the logcat should be working now!
回答4:
I have actually found an answer for this finally!
I was having another aimless look to see if anything had been updated about this anywhere and came across a post on xda-developers about a slightly different Huawei device with the same problem.
http://forum.xda-developers.com/showpost.php?p=17774398&postcount=93
It actually worked. I have complete logcat logging on my Huawei Sonic (U8650) now.
Three cheers for not giving up.
Solution, copied from the xda (in case it is removed etc):
There is a hidden service-menu where you can set loggin up. The
service-menu is started by "dialing" this phone number:
*#*#2846579#*#*
回答5:
I have a custom rom on my Samsung Captivate, but my approach may work for others as well:
Open up CMD or Terminal and type:
adb shell
logcat-enable
reboot
The rom I have is Continuum v6.1, but this still may work for others.
If you have the terminal emulator on the phone, you also may be able to do:
logcat-enable
and then just reboot the phone. I didn't try that, but it probably would work too. My phone is also rooted - don't know if that makes a difference.
回答6:
it was enough to restart the Huawei device
adb shell
reboot
回答7:
I'm having exactly the same problem. Someone from xda-developers wrote something as follows in msg #33
http://forum.xda-developers.com/showthread.php?t=1169869&page=4
One of the reason it can't be rooted is this phone had removed the "Logcat" mechanism from android. So, this makes most of rooting ways malfunction.
Maybe right maybe wrong i don't know.Anyway it gives some idea about the case.
来源:https://stackoverflow.com/questions/6941710/unable-to-open-log-device-dev-log-main-no-such-file-or-directory