开发者

Problem launching android AVM/SDK gui using the tools/android executable in the android SDK. Ubuntu 10.04, i686

开发者 https://www.devze.com 2023-01-08 21:15 出处:网络
Hi I just installed the android SDK along with Eclipse 3.5 on my i686 Thinkpad T60 running Ubuntu 10.04 (Lucid).(Eclipse was installed via synaptic, i.e. a package from the repository.) I installed th

Hi I just installed the android SDK along with Eclipse 3.5 on my i686 Thinkpad T60 running Ubuntu 10.04 (Lucid). (Eclipse was installed via synaptic, i.e. a package from the repository.) I installed the eclipse add on and everything on the Eclipse end seems fine. I also put the android-sdk tools directory on my user PATH. Now launching tools/android without any arguments is supposed to bring up the SDK and AVD manager GUI, but instead I get the following error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-gtk-3550 or swt-gtk in swt.library.path, java.library.path or the jar file
    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
    at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
    at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
    at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
    at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
    at com.android.sdkmanager.Main.showMainWindow(Main.java:265)
    at com.android.sdkmanager.Main.doAction(Main.java:249)
    at com.android.sdkmanager.Main.run(Main.java:94)
    at com.android.sdkmanager.Main.main(Main.java:83)

The strange thing is I definitely have all the prerequisites installed, sun-java6-jdk, and open-java6-jdk and have tried swi开发者_开发知识库tching between them. Also if I look in synaptic I have libswt-gtk-3.5java installed. Also he AVM/SDK manager launches fine when I launch it with eclipse.

(You may wonder why i care, but I like working from the command line, and considering using emacs as my IDE rather than Eclipse.)

If anyone knows how i can fix this please let me know.


(copied from Ubuntuforums http://ubuntuforums.org/showthread.php?t=1540054)

I had the same issue 12 months on. I discovered that it was because I had made the /tmp directory "noexec" as soon as I made it executable, we were fine.

sudo mount -o remount,exec /tmp

Hope this helps someone.


Additionally to what the user Bart well and correctly said I suggest to pay attention into the tip bellow:

Advanced linux users or geeks more often will face this issue. A "tweak" (usually to get more speed) applied in /etc/fstab making /tmp as noexec will cause this problem. Just open fstab and modify the entry as follow bellow:

sudo gedit /etc/fstab

If you have something like this just comment the line or modify the content:

tmpfs /tmp tmpfs defaults,noexec,nodev,nosuid 0 0

TO:

tmpfs /tmp tmpfs defaults,nodev,nosuid 0 0


Have a look at

android <command> --no-ui

This doesn't require SWT/GTK at all.


This is an old question, but I want to propose a less 'drastic' answer...

If you don't want to change your file-system mount, an alternative is that you can change the android tools startup script to explicitly specify the temporary directory that Java should use.

e.g. in the android-studio/sdk/tools directory, right at the end of the android script file is the command that executes java:

exec "$java_cmd" \
    -Djava.io.tmpdir=/home/me/android-studio/.tmp \
    -Xmx256M $os_opts $java_debug \
    -Dcom.android.sdkmanager.toolsdir="$progdir" \
    -classpath "$jarpath:$swtpath/swt.jar" \
    com.android.sdkmanager.Main "$@"

In this example I use "/home/me/android-studio/.tmp" but of course you change that to whatever you want.

Unfortunately this change will get overwritten if you update your Android tools so you would have to reapply it each time you update. You could instead export it in your profile as a global environment property (for all Java applications) instead of editing this script.


i also got this problem. I solved it by changing the ownership of the android sdk home directory (that i installed in '/opt') to me. This was done with something like:

sudo chown -R <username> /opt/android-sdk-linux 

And it worked fine !


just a better way to show the code.. consider this a comment from @Bart answer...

for some reason it tries to exec swt-lib from /tmp. that's wrong and dumb and i have no idea who's the culprit here (android or the java lib itself)

so, if you don't want to remount /tmp as RW, just symlink that swtlib dir to some place else. i moved it to the android dir.

(0) ~
hobo$ mv /tmp/swtlib-32 android/

(0) ~
hobo$ ln -sf ~/android/swtlib-32 /tmp/swtlib-32

(0) ~
hobo$ android/android-sdk-linux/tools/android 


Just delete contents of tmp dir.

sudo rm -rf /tmp/*

Try to launch android sdk manager afterwards. It worked for me.


If you want to launch sdk-manager via commandline, another option is, try running:

> sudo android sdk

This would run in admin mode giving you required permissions

0

精彩评论

暂无评论...
验证码 换一张
取 消