LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Trying to install Androd SDK but I get "Failed to create directory android_sdk_/temp" (https://www.linuxquestions.org/questions/linux-newbie-8/trying-to-install-androd-sdk-but-i-get-failed-to-create-directory-android_sdk_-temp-887380/)

Geet 06-20-2011 01:36 PM

Trying to install Androd SDK but I get "Failed to create directory android_sdk_/temp"
 
Hey everyone,

I'm a linux newbie and I'm running into problems when I'm trying to set up Android development environment on my computer. Long story short, I wanna know how to run eclipse as root without doing it through command prompt (when I do it through command prompt, I get an error - see below). But in case you wanna hear the long story, here it is (please be warned that the story is from a long time Windows user's frame of reference) ;):

I've downloaded the Android SDK, and now I'm trying to get the other packages that comes with the SDK with the Android SDK and AVD Manager. When trying to install a particular package, I get "Failed to create directory android-sdk-linux_x86/temp". I assumed this was because I was running "./android" as a user and not as root. So I logged in as su at the command prompt and tried running "./android" there. It then throws the following exception:

Starting Android SDK and AVD Manager
No command line parameters provided, launching UI.
See 'android --help' for operations from the command line.
No protocol specified
Exception in thread "main" org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.widgets.Display.createDisplay(Unknown Source)
at org.eclipse.swt.widgets.Display.create(Unknown Source)
at org.eclipse.swt.graphics.Device.<init>(Unknown Source)
at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
at org.eclipse.swt.widgets.Display.getDefault(Unknown Source)
at org.eclipse.swt.widgets.Shell.<init>(Unknown Source)
at org.eclipse.swt.widgets.Shell.<init>(Unknown Source)
at com.android.sdkuilib.internal.repository.UpdaterWindowImpl.createContents(UpdaterWindowImpl.java:118 )
at com.android.sdkuilib.internal.repository.UpdaterWindowImpl.open(UpdaterWindowImpl.java:98)
at com.android.sdkuilib.repository.UpdaterWindow.open(UpdaterWindow.java:98)
at com.android.sdkmanager.Main.showMainWindow(Main.java:312)
at com.android.sdkmanager.Main.doAction(Main.java:281)
at com.android.sdkmanager.Main.run(Main.java:99)
at com.android.sdkmanager.Main.main(Main.java:88)

So I'm guessing I should run the Android SDK and AVD Manager (./android) through eclipse. So here's my question:
I'm able to run eclipse as user (in which case Android SDK and AVD Manager gives the same error that it can't create the temp dir), but how do I run eclipse as root? When I try running eclipse as su from the command prompt, I get this error:


android-sdk-linux_x86/tools# eclipse
No protocol specified

(eclipse:13082): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(eclipse:13082): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed

(eclipse:13082): Gtk-CRITICAL **: gtk_settings_get_for_screen: assertion `GDK_IS_SCREEN (screen)' failed

(eclipse:13082): Gtk-WARNING **: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(eclipse:13082): Gtk-WARNING **: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(eclipse:13082): Gdk-CRITICAL **: gdk_screen_get_display: assertion `GDK_IS_SCREEN (screen)' failed

(eclipse:13082): Gdk-CRITICAL **: gdk_display_get_pointer: assertion `GDK_IS_DISPLAY (display)' failed

(eclipse:13082): Gtk-WARNING **: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(eclipse:13082): Gdk-CRITICAL **: gdk_screen_get_n_monitors: assertion `GDK_IS_SCREEN (screen)' failed

(eclipse:13082): Gtk-WARNING **: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(eclipse:13082): Gdk-CRITICAL **: gdk_screen_get_monitor_geometry: assertion `GDK_IS_SCREEN (screen)' failed

(eclipse:13082): Gdk-CRITICAL **: gdk_screen_get_default_colormap: assertion `GDK_IS_SCREEN (screen)' failed

(eclipse:13082): Gdk-CRITICAL **: gdk_colormap_get_visual: assertion `GDK_IS_COLORMAP (colormap)' failed

(eclipse:13082): Gdk-CRITICAL **: gdk_screen_get_default_colormap: assertion `GDK_IS_SCREEN (screen)' failed

(eclipse:13082): Gdk-CRITICAL **: gdk_screen_get_root_window: assertion `GDK_IS_SCREEN (screen)' failed

(eclipse:13082): Gdk-CRITICAL **: gdk_screen_get_root_window: assertion `GDK_IS_SCREEN (screen)' failed

(eclipse:13082): Gdk-CRITICAL **: gdk_window_new: assertion `GDK_IS_WINDOW (parent)' failed
Segmentation fault


I downloaded eclipse through apt. I'm unable to find the install directory. Where did apt download eclipse???

I'm not even sure if I'm on the right track, so any help would be greatly appreciated.

Thanks in advance!
Geet

MS3FGX 06-20-2011 07:55 PM

Unfortunately, you are not on the right track.

None of the Android SDK tools require Eclipse, so the problem isn't that you are running them stand alone. Furthermore, Eclipse should absolutely not be running as root, nor should any other GUI application for that matter. This has unexpected results in modern systems, as you are seeing here. In fact, both errors you are seeing are likely due to the fact it is trying to run GUI applications via root while X is running as a user.

The only issue you really have here is the "Failed to create directory" one. Where are you trying to extract the SDK to? It should be going under /home somewhere, anywhere else (like /opt or /usr) would cause a permissions error when trying to create a new directory.

Geet 06-21-2011 03:35 AM

Thanks MS3. My android installation is in Home/Downloads, so I'm not sure why it can't create the temp dir there. Has anyone else run into this problem or am I overlooking something? I'll try downloading the sdk again I guess.

Geet 06-23-2011 05:33 AM

I deleted my extracted folder and re-extracted the sdk tgz file once again and it worked!
 
I downloaded the sdk tgz file once more and extracted it and it worked just fine. Just to make sure, I went back to the first sdk tgz file I downloaded a few days back and extracted it once more as well - and that worked as well. So I'm thinking maybe it wasn't extracted right the first time I did it :-/ Anyway,m it's working now.


All times are GMT -5. The time now is 08:09 PM.