您好我正在尝试在ubuntu 14.04中安装androidsdk-uiautomatorviewer后打开uiautomatorviewer
每次我试图打开uiautomator查看器时,我都会收到以下错误。
root@xxxxxxx-HP-Z400-Workstation:/home/xxxxx# uiautomatorviewer
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jface/window/ApplicationWindow
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jface.window.ApplicationWindow
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 14 more
Could not find the main class: com.android.uiautomator.UiAutomatorViewer. Program will exit.
我明白为什么这个?我为sdk工具和平台工具设置了路径。请帮我摆脱它。
答案 0 :(得分:4)
要修复它,请使用此修补程序修改/usr/bin/uiautomatorviewer
:
--- /usr/bin/uiautomatorviewer.ori 2015-03-31 12:23:52.307244926 +0200
+++ /usr/bin/uiautomatorviewer 2015-03-31 12:28:19.849396991 +0200
@@ -74,5 +74,6 @@
done
jarpath="$frameworkdir/$jarfile"
+deps="$frameworkdir:/usr/lib/eclipse/plugins"
-exec "${javaCmd}" $javaOpts -Djava.ext.dirs="$frameworkdir" -Dcom.android.uiautomator.bindir="$progdir" -jar "$jarpath" "$@"
+exec "${javaCmd}" $javaOpts -Djava.ext.dirs="$deps" -Dcom.android.uiautomator.bindir="$progdir" -jar "$jarpath" "$@"
我刚刚在这里报告了错误:https://bugs.launchpad.net/ubuntu/+source/androidsdk-tools/+bug/1438629
编辑:或更好:
sudo ln -s ../../lib/eclipse/plugins/org.eclipse.jface_3.8.0.dist.jar /usr/share/java
sudo ln -s ../../lib/eclipse/plugins/org.eclipse.core.commands_3.6.1.dist.jar /usr/share/java