ObjectiveSideload an Android app from Ubuntu to a mobile device.
DistributionsThis guide is tailored to Ubuntu, but the same principles will work on any distribution.
RequirementsA working Ubuntu install with root privileges and an Android device.
- # - requires given command to be executed with root privileges either directly as a root user or by use of
- $ - given command to be executed as a regular non-privileged user
IntroductionInstalling an app on Android isn't always as simple as downloading it from the Play Store. In a lot of cases, especially development, the Play Store isn't an option, and you need another way to push apps to an Android device.
Google's Android Debug Bridge(ADB) was designed for situations just like that. Actually, it can do a lot more than that, but it's perfect for pushing apps to an Android device on your network, whether it has a traditional download method or not.
Install ADBGoogle recommends developing for Android on Ubuntu, so it's the ideal platform. Start by installing ADB and Fastboot.
$ sudo apt install android-tools-adb android-tools-fastboot
Configure AndroidBy default, Android won't allow access from a remote machine and won't install unknown packages. That make sense for security reasons, but it's standing in your way for this.
Open up your Android device head to the Settings app. Click on the "Security" section, and find a setting labeled "Unknown Sources." Enable that.
Head up one level and scroll down to "About phone." Tap on that, and find the Android build information. Tap seven times on the Android build number. That will enable developer settings on the device. Android will tell you when the settings are enabled.
Once they are, go up one level again, and you'll see a new listing for "Developer options." Tap on that. Look for a setting titled, "Debugging," and locate a setting for "Android debugging" under it. Switch debugging on.
Get An AppIf you've already got an app that you want to use, this part isn't for you. If you're looking to install something specific from the Android ecosystem, then you can probably find it on APKMirror. Search around there for the APK that you want. Make sure that the one you download is compatible with your device.
SideloadGo back to the Settings app, and find "About phone." Under that, click on "Status." Find your device's IP address, and make note of it. Back on Ubuntu, open a terminal, and connect to your device with it's IP address.
$ adb connect 192.168.1.110If all goes well, Ubuntu will connect and return you to the command prompt. Now, you can install the APK that you downloaded. Again, it's a simple command.
$ adb install /path/to/app.apkADB will output some information on the upload process, and will tell you if the installation was successful. To be sure, jump back over to the device. Check your apps to see that it's there.