[英]androidStudio log doesn't work
I cannot get log to work on my phone.我无法在我的手机上获取日志。 I only get this error in Android Studio:
我只在 Android Studio 中收到此错误:
11-01 03:28:56.427 24227-24375/com.example.segall.caveofprogcourse E/GED: Failed to get GED Log Buf, err(0)
11-01 03:28:56.427 24227-24375/com.example.segall.caveofprogcourse E/GED:无法获得 GED 日志缓冲区,错误(0)
Android studio 2.1.3
安卓工作室 2.1.3
Ubuntu 16.04 LTSUbuntu 16.04 LTS
Sony Xperia M5索尼 Xperia M5
android 6.0 api 23安卓 6.0 API 23
I have USB Debugging on.我打开了 USB 调试。
Edit编辑
This code in onCreate method onCreate 方法中的此代码
Log.d("mylog", " LOG WORKS ");
Log.e("mylog", "onCreate called really?"); // I added this Log
gets the following results:得到以下结果:
11-01 21:51:23.561 7820-7820/com.example.segall.caveofprogcourse E/mylog: onCreate called really?
11-01 21:51:23.619 7820-7873/com.example.segall.caveofprogcourse E/GED: Failed to get GED Log Buf, err(0)
surprisingly, the Log.e works.令人惊讶的是,Log.e 有效。 Anyone know why this might have happened?
有谁知道为什么会发生这种情况?
Edit 2 I created new project only with two logs in onCreate编辑 2我在 onCreate 中仅使用两个日志创建了新项目
Log.d("mylog","Log.d on create this is not working");
Log.e("mylog","Log.e surprisingly this works");
I put a few empty line so it's easy to spot我放了一些空行,所以很容易发现
log filter from app:来自应用程序的日志过滤器:
11-02 02:24:08.858 24802-24802/com.example.segall.logapp W/ResourceType: Found multiple library tables, ignoring...
11-02 02:24:08.863 24802-24802/com.example.segall.logapp W/System: ClassLoader referenced unknown path: /data/app/com.example.segall.logapp-1/lib/arm64
11-02 02:24:08.885 24802-24811/com.example.segall.logapp I/System: FinalizerDaemon: finalize objects = 1
11-02 02:24:09.038 24802-24802/com.example.segall.logapp W/System: ClassLoader referenced unknown path: /data/app/com.example.segall.logapp-1/lib/arm64
11-02 02:24:09.180 24802-24802/com.example.segall.logapp W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
11-02 02:24:09.366 24802-24802/com.example.segall.logapp E/mylog: Log.e surprisingly this works
11-02 02:24:09.435 24802-24833/com.example.segall.logapp E/GED: Failed to get GED Log Buf, err(0)
11-02 02:24:09.439 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Initialized EGL, version 1.4
11-02 02:24:09.448 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Get enable program binary service property (1)
11-02 02:24:09.448 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Initializing program atlas...
11-02 02:24:09.449 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Program binary detail: Binary length is 360191, program map length is 152.
11-02 02:24:09.449 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Succeeded to mmap program binaries. File descriptor is 38, and path is /dev/ashmem�.
11-02 02:24:09.449 24802-24833/com.example.segall.logapp I/OpenGLRenderer: No need to use file discriptor anymore, close fd(38).
11-02 02:24:09.452 24802-24833/com.example.segall.logapp W/libEGL: [ANDROID_RECORDABLE] format: 1
11-02 02:24:09.569 24802-24802/com.example.segall.logapp I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@aec4c2c time:73133463
log filter no filter:日志过滤器没有过滤器:
--------- beginning of system
11-02 02:29:48.790 1014-2030/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.segall.logapp/.MainActivity} from uid 2000 from pid 29625 on display 0
11-02 02:29:48.790 1014-2030/? W/PackageManager: checkUidPermission(): android.permission.START_ANY_ACTIVITY of 2000 is denied.
11-02 02:29:48.792 1014-1231/? I/libPerfService: 1: set freq: 1950000
11-02 02:29:48.792 1014-1231/? I/libPerfService: 1: set: 4
11-02 02:29:48.793 1014-2030/? I/PowerManagerService: setBrightness mButtonLight 0.
11-02 02:29:48.798 1014-2036/? W/PackageManager: checkUidPermission(): android.permission.WRITE_MEDIA_STORAGE of 10014 is denied.
11-02 02:29:48.798 1014-2036/? W/PackageManager: checkUidPermission(): android.permission.READ_EXTERNAL_STORAGE of 10014 is denied.
11-02 02:29:48.800 330-330/? I/BufferQueue: [unnamed-330-1869](this:0x7fae55d400,id:1869,api:0,p:-1,c:-1) BufferQueue core=(330:/system/bin/surfaceflinger)
11-02 02:29:48.800 330-330/? I/BufferQueueConsumer: [unnamed-330-1869](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) connect(C): consumer=(330:/system/bin/surfaceflinger) controlledByApp=false
11-02 02:29:48.800 330-330/? I/BufferQueueConsumer: [unnamed-330-1869](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) setConsumerName: unnamed-330-1869
11-02 02:29:48.800 330-330/? I/BufferQueueConsumer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) setConsumerName: Starting com.example.segall.logapp
11-02 02:29:48.800 330-330/? I/BufferQueueConsumer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) setDefaultBufferSize: width=1 height=1
11-02 02:29:48.803 330-330/? I/BufferQueueConsumer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) setDefaultBufferSize: width=1080 height=1920
11-02 02:29:48.803 330-330/? I/SurfaceFlinger: [Built-in Screen (type:0)] fps:1.709773,dur:4094.11,max:3980.13,min:16.10
11-02 02:29:48.807 330-443/? I/BufferQueueProducer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:2,p:1014,c:330) connect(P): api=2 producer=(1014:system_server) producerControlledByApp=false
11-02 02:29:48.807 330-1043/? I/BufferQueueProducer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:2,p:1014,c:330) new GraphicBuffer needed
11-02 02:29:48.809 29645-29645/? I/art: Late-enabling -Xcheck:jni
11-02 02:29:48.809 1014-2036/? I/ActivityManager: Start proc 29645:com.example.segall.logapp/u0a14 for activity com.example.segall.logapp/.MainActivity
11-02 02:29:48.810 1014-1032/? W/PackageManager: checkUidPermission(): android.permission.INTERNET of 10014 is denied.
11-02 02:29:48.815 1014-1036/? I/WindowManager: Focus moving from Window{da2cb0d u0 com.android.systemui/com.android.systemui.recents.RecentsActivity} to null
11-02 02:29:48.815 1014-1036/? I/WindowManager: Losing focus: Window{da2cb0d u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
11-02 02:29:48.825 1014-1378/? I/libPerfService: perfSetFavorPid - pid:29645, 73cd
11-02 02:29:48.839 29645-29645/com.example.segall.logapp W/ResourceType: Found multiple library tables, ignoring...
11-02 02:29:48.844 330-443/? I/BufferQueueProducer: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:330) disconnect(P): api 1
11-02 02:29:48.844 330-443/? I/BufferQueueConsumer: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:330) getReleasedBuffers: returning mask 0xffffffffffffffff
11-02 02:29:48.849 330-1043/? I/BufferQueueProducer: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:330) disconnect(P): api 1
11-02 02:29:48.851 29645-29654/com.example.segall.logapp I/System: FinalizerDaemon: finalize objects = 1
11-02 02:29:48.853 29645-29645/com.example.segall.logapp W/System: ClassLoader referenced unknown path: /data/app/com.example.segall.logapp-1/lib/arm64
11-02 02:29:48.975 29645-29645/com.example.segall.logapp W/System: ClassLoader referenced unknown path: /data/app/com.example.segall.logapp-1/lib/arm64
11-02 02:29:48.977 1014-2030/? W/PackageManager: checkUidPermission(): android.permission.INTERACT_ACROSS_USERS_FULL of 10014 is denied.
11-02 02:29:48.977 1014-2030/? W/PackageManager: checkUidPermission(): android.permission.REAL_GET_TASKS of 10014 is denied.
11-02 02:29:48.977 1014-2030/? W/PackageManager: checkUidPermission(): android.permission.GET_TASKS of 10014 is denied.
11-02 02:29:48.998 330-330/? I/BufferQueueProducer: [FrameBufferSurface_0](this:0x7fb0759000,id:0,api:1,p:330,c:330) queueBuffer: fps=2.00 dur=5985.78 max=5805.78 min=14.24
11-02 02:29:49.063 330-330/? I/BufferQueueConsumer: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:-1) disconnect(C)
11-02 02:29:49.064 330-330/? I/BufferQueue: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:-1) ~BufferQueueCore
11-02 02:29:49.128 29645-29645/com.example.segall.logapp W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
11-02 02:29:49.143 1014-2075/? W/PackageManager: checkUidPermission(): android.permission.INTERACT_ACROSS_USERS of 10014 is denied.
11-02 02:29:49.143 1014-14701/? W/PackageManager: checkUidPermission(): android.permission.INTERACT_ACROSS_USERS_FULL of 10014 is denied.
11-02 02:29:49.213 1014-4093/? I/PowerManagerService: setBrightness mButtonLight 0.
11-02 02:29:49.217 1014-1377/? I/PowerManagerService: setBrightness mButtonLight 0.
11-02 02:29:49.217 1014-1378/? I/PowerManagerService: setBrightness mButtonLight 0.
11-02 02:29:49.219 1014-30758/? I/PowerManagerService: setBrightness mButtonLight 0.
11-02 02:29:49.317 29645-29645/com.example.segall.logapp E/mylog: Log.e surprisingly this works
11-02 02:29:49.320 330-443/? I/SurfaceFlinger: EventThread Client Pid (29645) created
11-02 02:29:49.323 330-443/? I/SurfaceFlinger: EventThread Client Pid (29645) created
11-02 02:29:49.334 330-1043/? I/SurfaceFlinger: [SF client] NEW(0x7fae011a80) for (1014:system_server)
11-02 02:29:49.367 1014-1986/? W/PackageManager: checkUidPermission(): android.permission.STATUS_BAR of 10014 is denied.
11-02 02:29:49.368 330-330/? I/BufferQueue: [unnamed-330-1870](this:0x7fae55e800,id:1870,api:0,p:-1,c:-1) BufferQueue core=(330:/system/bin/surfaceflinger)
11-02 02:29:49.368 330-330/? I/BufferQueueConsumer: [unnamed-330-1870](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) connect(C): consumer=(330:/system/bin/surfaceflinger) controlledByApp=false
11-02 02:29:49.368 330-330/? I/BufferQueueConsumer: [unnamed-330-1870](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) setConsumerName: unnamed-330-1870
11-02 02:29:49.368 330-330/? I/BufferQueueConsumer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) setConsumerName: com.example.segall.logapp/com.example.segall.logapp.MainActivity
11-02 02:29:49.368 330-330/? I/BufferQueueConsumer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) setDefaultBufferSize: width=1 height=1
11-02 02:29:49.376 330-330/? I/BufferQueueConsumer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) setDefaultBufferSize: width=1080 height=1920
11-02 02:29:49.379 1014-1036/? I/WindowManager: Focus moving from null to Window{4f3b63c u0 com.example.segall.logapp/com.example.segall.logapp.MainActivity}
11-02 02:29:49.379 1014-1036/? I/WindowManager: Gaining focus: Window{4f3b63c u0 com.example.segall.logapp/com.example.segall.logapp.MainActivity}
11-02 02:29:49.380 29645-29672/com.example.segall.logapp E/GED: Failed to get GED Log Buf, err(0)
11-02 02:29:49.384 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Initialized EGL, version 1.4
11-02 02:29:49.394 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Get enable program binary service property (1)
11-02 02:29:49.394 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Initializing program atlas...
11-02 02:29:49.395 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Program binary detail: Binary length is 360191, program map length is 152.
11-02 02:29:49.395 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Succeeded to mmap program binaries. File descriptor is 38, and path is /dev/ashmem�.
11-02 02:29:49.395 29645-29672/com.example.segall.logapp I/OpenGLRenderer: No need to use file discriptor anymore, close fd(38).
11-02 02:29:49.398 330-440/? I/BufferQueueProducer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:1,p:29645,c:330) connect(P): api=1 producer=(29645:com.example.segall.logapp) producerControlledByApp=true
11-02 02:29:49.398 29645-29672/com.example.segall.logapp W/libEGL: [ANDROID_RECORDABLE] format: 1
11-02 02:29:49.399 330-1044/? I/BufferQueueProducer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:1,p:29645,c:330) new GraphicBuffer needed
11-02 02:29:49.406 330-443/? I/BufferQueueProducer: [StatusBar](this:0x7fb075a400,id:8,api:1,p:1335,c:330) queueBuffer: fps=0.15 dur=6482.88 max=6482.88 min=6482.88
11-02 02:29:49.460 1014-1036/? I/ActivityManager: [AppLaunch] Displayed Displayed com.example.segall.logapp/.MainActivity: +661ms
11-02 02:29:49.460 1014-1036/? I/Timeline: Timeline: Activity_windows_visible id: ActivityRecord{548a061 u0 com.example.segall.logapp/.MainActivity t1972} time:73473354
11-02 02:29:49.460 1014-1231/? I/libPerfService: 1: set: 1
11-02 02:29:49.460 1014-1231/? I/libPerfService: 1: set freq: 0
11-02 02:29:49.460 1014-1231/? I/libPerfService: 1: set vcore level: 0
11-02 02:29:49.515 330-1043/? I/BufferQueueProducer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:1,p:29645,c:330) new GraphicBuffer needed
11-02 02:29:49.531 2491-2496/? I/PerfService: PerfServiceNative_getPackName
11-02 02:29:49.532 1014-1378/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.532 1014-1378/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.532 1014-1378/? E/PerfService: com.example.segall.logapp
11-02 02:29:49.534 1014-1378/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.534 1014-1378/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.534 1014-1378/? E/PerfService: com.example.segall.logapp
11-02 02:29:49.534 2491-2496/? I/PerfService: com.example.segall.logapp
11-02 02:29:49.534 2491-2496/? I/PerfService: PerfServiceNative_getPackName
11-02 02:29:49.534 1014-14701/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.534 1014-14701/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.534 1014-14701/? E/PerfService: com.example.segall.logapp
I had the same problem.我有同样的问题。 Please update your Android Studio.
请更新您的 Android Studio。 It was a bug
这是一个错误
With Linux(Ubuntu), you have Set up your system to detect your device.使用 Linux(Ubuntu),您已设置系统以检测您的设备。 You may check theseGoogle guidelines
您可以查看这些Google 指南
You need to add a udev rules
file that contains a USB configuration
for each type of device you want to use for development.您需要添加一个
udev rules
文件,其中包含要用于开发的每种类型的设备的USB configuration
。
Before doing this, Verify that your application is "debuggable" in your manifest or build.gradle
file.在执行此操作之前,请验证您的应用程序在您的清单或
build.gradle
文件中是“可调试的”。
android {
buildTypes {
debug {
debuggable true
}
In the AndroidManifest.xml
file, add android:debuggable="true"
to the <application>
element.在
AndroidManifest.xml
文件中,将android:debuggable="true"
到<application>
元素。
Now set up your system to detect your device using a udev rules file.现在设置您的系统以使用udev 规则文件检测您的设备。 Add a udev rules file that contains a USB configuration for each type of device you want to use for development.
添加一个 udev 规则文件,其中包含要用于开发的每种类型的设备的 USB 配置。 In the rules file, each device manufacturer is identified by a unique vendor ID, as specified by the
ATTR{idVendor}
property.在规则文件中,每个设备制造商都由唯一的供应商 ID 标识,由
ATTR{idVendor}
属性指定。 So you have to know Sonys vendor id in your case: 054c
所以你必须知道你的案例中的索尼供应商 ID:
054c
/etc/udev/rules.d/51-android.rules
/etc/udev/rules.d/51-android.rules
ie即
sudo gedit /etc/udev/rules.d/51-android.rules
Use this format to add each vendor to the file: 054c is sonys vendor id.使用此格式将每个供应商添加到文件中:054c 是 sonys 供应商 ID。
SUBSYSTEM=="usb", ATTR{idVendor}=="054c", MODE="0666", GROUP="plugdev"
If you add SUBSYSTEM=="usb", ATTR{idVendor}=="054c", MODE="0666", GROUP="plugdev"
Android studio will detect Sony.如果添加
SUBSYSTEM=="usb", ATTR{idVendor}=="054c", MODE="0666", GROUP="plugdev"
Android studio 会检测到 Sony。
chmod a+r /etc/udev/rules.d/51-android.rules
chmod a+r /etc/udev/rules.d/51-android.rules
Close and start Studio.关闭并启动 Studio。 Then run run your project.
然后运行运行你的项目。 Studio will detect it
Studio 会检测到它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.