Announcement

Collapse
No announcement yet.

Running Android Studio from USB Flash drive

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Running Android Studio from USB Flash drive

    I managed to install Android Studio/Java SDKs/Android SDK on a USB flash drive and configure it so that it runs entirely off of that drive. To verify I plugged it into a PC that had never had any of these components and successfully built the robot controller apk. Because I'm using a USB 3.0 OTG drive I was then able to plug the drive directly into my phone and install the APK from there.

    While I don't yet have the ZTE speed I have no reason to think that this won't work with it since it supports OTG. It works on my Galaxy S4.

    If nothing else this would be a good backup solution in an emergency. I've seen teams have trouble with laptops at competitions while frantically trying to make program changes right before a match. With this technique you'd theoretically be able to use someone else's machine in a pinch. While I did this under windows I have no reason to think you couldn't set up something equivalent for MacOs or Linux.

    Theoretically FIRST could optionally offer a pre-loaded USB drive in the future along with the kit of parts.

    If anyone is interested in trying this I'd be happy to help out if you get stuck.

  • #2
    Originally posted by mlwilliams View Post
    I managed to install Android Studio/Java SDKs/Android SDK on a USB flash drive and configure it so that it runs entirely off of that drive. To verify I plugged it into a PC that had never had any of these components and successfully built the robot controller apk. Because I'm using a USB 3.0 OTG drive I was then able to plug the drive directly into my phone and install the APK from there.

    While I don't yet have the ZTE speed I have no reason to think that this won't work with it since it supports OTG. It works on my Galaxy S4.

    If nothing else this would be a good backup solution in an emergency. I've seen teams have trouble with laptops at competitions while frantically trying to make program changes right before a match. With this technique you'd theoretically be able to use someone else's machine in a pinch. While I did this under windows I have no reason to think you couldn't set up something equivalent for MacOs or Linux.

    Theoretically FIRST could optionally offer a pre-loaded USB drive in the future along with the kit of parts.

    If anyone is interested in trying this I'd be happy to help out if you get stuck.
    Sounds like a great idea to me.

    I'd be interested, but don't know how to go about setting it up for the flash drive vs the pc.
    How big was the entire footprint, and would it depend on your flavor of windows?

    Phil.

    Comment


    • #3
      Android Studio won't; the Java JDK will (unless you are carrying around just the x64 version and rely on Windows supporting the x86 JDK). Android Studio and the SDK are portable, so that makes life easy. Don't forget that if the Android Studio config is bad, this won't work (as Android Studio relies on the configuration with "%userprofile%\.AndroidStudio1.3" or " "%userprofile%\.AndroidStudio1.2." What happens if the the drive letter is different than what the drive is expecting (just checking that case is handled)?

      Comment


      • #4
        I created the USB drive from my Windows 10 workstation and later tested it from a Windows 7 laptop. Both are 64-bit versions of Windows but should work fine using the 32-bit versions of everything.

        Since Java stuff tends to properly support multiple platforms you don't have to worry too much about doing an actual install and things like the windows registry. Just copying folders to the flash drive seems sufficient.

        I added a windows batch file in the root of the drive to properly set up path variables and launch the IDE:

        RunAndroidStudio.bat
        set Path=\Java\jdk1.7.0_79\bin;%Path%
        set JDK_HOME=%JDK%\java\jdk1.7.0_79
        set JAVA_HOME=%JAVA%\java\jdk1.7.0_79
        "\Android Studio\bin\studio64.exe"


        The next thing to overcome is the fact that windows will assign a drive letter to the USB drive that may be different on a different machine. In either case you have to open Android Studio project and choose File -> Project Structure and set the appropriate SDK paths - pointing to the current flash drive location of each.

        The footprint is rather large mainly because I did a full install on the PC and later just copied directories to the flash drive. The Android SDK has a couple of versions and far more features (like Google glass support) that we'd never need.

        Folder Size
        Android Studio
        645 MB
        Android SDK
        16.3 GB
        Java JRE/JDK
        912 MB
        FTC SDK/Project folder
        43 MB

        Comment


        • #5
          Maybe a solution to our problem installations

          I really like your idea. It never occurred to me that you could just copy an installation over. Would you say that if I have a working Android installation on one computer, I could just copy the directories over to another computer, regardless of operating system (xp, win7, win8 etc)? Aren't there any registry issues?

          In our installations, we have one Win7 computer that works perfectly and four others that all have problems. The Win8 will not compile and send the code to the phone, one of the Win7 and the xp computers fail on startup when the SDK info is "fetched" I get the following error "
          java.lang.RuntimeException: java.lang.IllegalArgumentException: Argument for @NotNull parameter 'name' of com/android/tools/idea/welcome/Platform.<init> must not be null at com.intellij.idea.IdeaApplication.run(IdeaApplicat ion.java:178)" plus a lot of other detail but this is the main issue. Once this comes up, it crashes.

          So I'm wondering if I can apply your idea to either the usb or other computers to fix the flawed installations. (on the other hand, if you know how to get beyond this error...I'd be happy to apply the fix and move on)

          Comment


          • #6
            The batch variable "%~dp0" adjusts to the drive letter. The minimum SDK for USB use is 2.02GB.

            Comment


            • #7
              Originally posted by FTC7089 View Post
              I really like your idea. It never occurred to me that you could just copy an installation over. Would you say that if I have a working Android installation on one computer, I could just copy the directories over to another computer, regardless of operating system (xp, win7, win8 etc)? Aren't there any registry issues?

              In our installations, we have one Win7 computer that works perfectly and four others that all have problems. The Win8 will not compile and send the code to the phone, one of the Win7 and the xp computers fail on startup when the SDK info is "fetched" I get the following error "
              java.lang.RuntimeException: java.lang.IllegalArgumentException: Argument for @NotNull parameter 'name' of com/android/tools/idea/welcome/Platform.<init> must not be null at com.intellij.idea.IdeaApplication.run(IdeaApplicat ion.java:178)" plus a lot of other detail but this is the main issue. Once this comes up, it crashes.

              So I'm wondering if I can apply your idea to either the usb or other computers to fix the flawed installations. (on the other hand, if you know how to get beyond this error...I'd be happy to apply the fix and move on)

              Open the folder "bin" under the directory where you installed your Android Studio. (C:\Program Files\Android\Android Studio\bin)
              Find the file "idea.properties" and open it with Notepad++/UltraEdit/other_edit_tools.
              Add "disable.android.first.run=true" as the final line and save the file.
              Restart Android Studio.

              from: http://stackoverflow.com/questions/3...r-installation

              Comment

              Working...
              X