如何解决 Uiautomatorviewer 问题:GTK3 不支持 GDK_NATIVE_WINDOWS 环境变量

如何解决 Uiautomatorviewer 问题:GTK3 不支持 GDK_NATIVE_WINDOWS 环境变量

我输入$uiautomatorviewer了错误,如下所示

(java:642): Gdk-WARNING **: 00:33:28.349: The GDK_NATIVE_WINDOWS environment variable is not supported in GTK3.
See the documentation for gdk_window_ensure_native() on how to get native windows.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
    no swt-cairo-gtk-4919 in java.library.path
    no swt-cairo-gtk in java.library.path
    Can't load library: /usr/lib/jni/libswt-cairo-gtk-4919.so
    Can't load library: /usr/lib/jni/libswt-cairo-gtk.so
    Can't load library: /home/checkpoint/.swt/lib/linux/x86_64/libswt-cairo-gtk-4919.so
    Can't load library: /home/checkpoint/.swt/lib/linux/x86_64/libswt-cairo-gtk.so

at org.eclipse.swt.internal.Library.loadLibrary(Library.java:334)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:242)
at org.eclipse.swt.internal.cairo.Cairo.<clinit>(Cairo.java:28)
at org.eclipse.swt.widgets.Display.createDisplay(Display.java:1059)
at org.eclipse.swt.widgets.Display.create(Display.java:1025)
at org.eclipse.swt.graphics.Device.<init>(Device.java:179)
at org.eclipse.swt.widgets.Display.<init>(Display.java:590)
at org.eclipse.swt.widgets.Display.<init>(Display.java:581)
at org.eclipse.swt.widgets.Display.getDefault(Display.java:2450)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:271)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:370)
at org.eclipse.jface.window.Window.createShell(Window.java:487)
at org.eclipse.jface.window.Window.create(Window.java:430)
at org.eclipse.jface.window.Window.open(Window.java:790)
at com.android.uiautomator.UiAutomatorViewer.main(UiAutomatorViewer.java:76)

然后我尝试了$ export GDK_NATIVE_WINDOWS=true,, $ export GDK_NATIVE_WINDOWS=1然后$ export LD_LIBRARY_PATH=/usr/lib/jni,然后$ export PATH=./bin:$PATH..请了解在 Ubuntu 18.04 中打开 UIautomatorviewer 的步骤。这是针对 Appium + android studio 移动应用程序测试的。

答案1

请尝试:

sudo apt install libswt-cairo-gtk-4-jni

相关内容