Sunday, November 2, 2014

Install Android Studio/SDK on Debian Wheezy 64bit

THIS IS A WORK IN PROGRESS


Android development has piqued my interest! Here are the steps I took to get Android Studio/SDK installed in Debian Wheezy 64bit. As always, read it, test it out, and provide feedback. Here we go...

ASSUMPTIONS

  • Debian Wheezy 64bit

INSTALL ANDROID STUDIO/SDK SYSTEM REQUIREMENTS

  1. Enable Debian multiarch i386 to allow 32bit applications to run.
  2. dpkg --add-architecture i386
    apt-get update
  3. Install required libs for Android SDK.
  4. apt-get install libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386
  5. Ensure you have contrib enabled in sources.list for java-package.
  6. nano /etc/apt/sources.list
    deb http://http.debian.net/debian wheezy main contrib non-free
    deb-src http://http.debian.net/debian wheezy main contrib non-free
    # update after edit sources.list
    apt-get update
  7. Oracle JDK is no longer available in Debian Wheezy. Install java-package so we can create a JDK8 deb. We are using multiarch so you will need to specify the architecture to install.
  8. apt-get install java-package:amd64 fakeroot:amd64
  9. Edit java-package to allow building of a JDK8 deb. Insert the following at line 49.
  10. 
    nano -c /usr/share/java-package/oracle-j2sdk.sh
    "jdk-8u"[0-9]"-linux-x64.tar.gz") # SUPPORTED
                j2se_version=1.8.0+update${archive_name:6:1}${revision}
                j2se_expected_min_size=310 #Mb
                j2se_priority=319
                found=true
                ;;
    "jdk-8u"[0-9][0-9]"-linux-x64.tar.gz") # SUPPORTED
                j2se_version=1.8.0+update${archive_name:6:2}${revision}
                j2se_expected_min_size=310 #Mb
                j2se_priority=319
                found=true
                ;;
  11. Download JDK8 (as of this writing): Oracle Java Download

  12. Generate a Debian package.
  13. make-jpkg jdk-8u25-linux-x64.tar.gz
  14. Install the binary package created.
  15. dpkg -i oracle-j2sdk1.8_1.8.0+update25_amd64.deb
  16. Set default java.
  17. update-alternatives --config java
    update-alternatives --config javac
    update-alternatives --config javaws
  18. Verify your java version.
  19. java -version
    javac -version

INSTALL ANDROID STUDIO

  1. Download Android Studio: Android Studio Download

  2. Extract the package. I just right clicked > Extract here.

  3. As root or using sudo, move the package to it's destination.
  4. mv /home/melissa/Downloads/asb/android-studio /opt/
  5. Create a symbolic link so studio can be launched from the command line.
  6. ln -s /opt/android-studio/bin/studio.sh /usr/local/bin/asb
  7. Make a menu option for your installed application.
  8. leafpad android-studio.desktop
    [Desktop Entry]
     Name=Android-Studio
     Comment=your comments
     Exec=/opt/android-studio/bin/studio.sh
     Icon=/opt/android-studio/bin/idea.png
     Terminal=false
     Type=Application
     Categories=Utility;IDE;Development;
  9. Install the menu option just created.
  10. desktop-file-install android-studio.desktop

INSTALL ANDROID SDK

  1. Download Android SDK "for existing ide": Android SDK Download

  2. Extract the package. I just right clicked > Extract Here.

  3. As root or using sudo, move the extracted package to it's destination.
  4. mv android-sdk-linux /opt/
  5. Create a symbolic link so Android Debugger can be launched from the command line.
  6. ln -s /opt/android-sdk-linux/platform-tools/adb /usr/local/bin/

SET SDK LOCATION WITHIN ANDROID STUDIO

  1. Start Android Studio from your new menu option.

  2. Navigate to Configure > Project Defaults > Project Structure.

  3. Fill in the Android SDK Location: /opt/android-sdk-linux/

  4. Click Apply > Ok.

REFERENCES

http://askubuntu.com/questions/421389/where-to-unpack-the-android-studio-file
http://forums.debian.net/viewtopic.php?f=16&t=114690
http://tutorialforlinux.com/2014/03/13/how-to-install-android-studio-bundle-on-debian-wheezy-7-3264bit-linux-easy-guide/
https://developer.android.com/sdk/installing/studio.html
https://wiki.debian.org/JavaPackage
https://wiki.debian.org/Multiarch/HOWTO
https://wiki.debian.org/Java/Sun
https://developer.android.com/sdk/installing/adding-packages.html
https://developer.android.com/tools/help/sdk-manager.html
https://developer.android.com/tools/help/adb.html
http://crunchbang.org/forums/viewtopic.php?id=34556
https://www.java.com/en/download/faq/java_webstart.xml

10 comments:

  1. GNU nano 2.2.6 File: ConnectPhoneToAndroidStudio

    1. Create a file called android.rules
    2. Without switching directories, run the following commands :
    a. sudo cp android.rules /etc/udev/rules.d/51-android.rules
    b. sudo chmod 644 /etc/udev/rules.d/51-android.rules
    c. sudo chown root. /etc/udev/rules.d/51-android.rules
    d. sudo service udev restart
    e. sudo your-path-to-adb-executable/adb kill-server
    f. sudo your-path-to-adb-executable/adb start-server
    g. your-path-to-adb-executable/adb devices

    3. Will be able to see on Android Studio


    [Credits: http://stackoverflow.com/questions/9210152/set-up-device-for-developm$

    ReplyDelete
  2. Thank you for the tips! It will definitely help other people looking to connect their phones once Android Studio is setup!

    ReplyDelete
  3. Really its a very nice written document

    ReplyDelete
  4. How do I make the menu of options shown in Step 5?
    What is leafpad?

    Thank you, excuse my ignorance about it.

    ReplyDelete
  5. Leafpad is a graphical text editor. So in step 5 if you execute that command in the terminal it will launch Leafpad and edit/create the android-studio.desktop file needed so you can paste and save the remaining Desktop Entry into it and save. Step 6 then has you install the file you just created. I hope that helps clear things up.

    ReplyDelete
  6. It says, Key file does not start with a group

    ReplyDelete
    Replies
    1. Sorry for the late reply. What specific step are you getting this response on?

      Delete
  7. Sure way of installing and using Android Studio!
    I'm truly amazed at your exact instruction. Even though I'm not a linux expert I could make it.
    Warm thanks, Melissa.

    ReplyDelete
  8. Melissa,

    Amazing sure way of installing and using Android Studio!
    Your succinct and exact instruction made me succeed.
    The only thing I chaned is x64 -> i586 for an intel laptop user.
    I deeply thank you.

    ReplyDelete
    Replies
    1. You're very welcome. If there is anything you would like explored in linux, let me know and I will write it up the best I can.

      Delete