Make Android Development in Ubuntu

来源:互联网 发布:资产管理系统源码 编辑:程序博客网 时间:2024/05/19 12:15

In China,for access Google Service,you must have a vpn. Here I use ExpressVPN,it’s installation is very easy,download installation file ending with .deb,then run sudo dpkg -i file.deb.

1.install openjdk

In terminal run

$ java

it’ll info you, java not installed and can be found in below packages.
Then we choose the last one to install

Here , we choose to install last one.

$ sudo apt install openjdk_9_jre_headless

这里写图片描述
Be careful: when you execute install commend in terminal,then terminal warn like

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

It’s possible you have some software is installing for Ubuntu Software or other terminal.

Then execute

$ javac

这里写图片描述

just as before,then we execute

$ sudo apt install openjdk-9-jdk

这里写图片描述

there is a crash, you can repair it as follow:

sudo dpkg --configure -a
sudo dpkg -i --force-overwrite '/var/cache/apt/archives/openjdk-9-jdk_9~b114-0ubuntu1_amd64.deb'

openjdk-9-jdk_9~b114-0ubuntu1_amd64.deb is you downloaded openjdk9 package,it can be some different.

这里写图片描述

refer :http://askubuntu.com/questions/769467/can-not-install-openjdk-9-jdk-because-it-tries-to-overwrite-file-aready-includ

$ javac

it’s probably OKif not , reboot try again.

You may wonder how about just install openjdk-9-jdk? I don’t try,so I don’t know.

2.Install Android Studio

1.Download Android Studio from developer.android.com,then unpack downloaded zip file like below:

sudo apt-get install unzip
sudo unzip file.zip -d destination_folder

2.launch Android Studio, open a terminal, navigate to the android-studio/bin/ directory, and execute

$ ./studio.sh

Then execute,as Wizard .

Be careful:Required libraries for 64-bit machines,you can install as follow:
At first enable multi-arch support (if not done already):

$ sudo dpkg --add-architecture i386

then

$ sudo apt-get update
$ sudo apt-get install libbz2-1.0:i386

refer from:http://askubuntu.com/questions/637113/unable-to-locate-package-lib32bz2-1-0
IMHO,android government method cannot use.

3.Run Apps on a Hardware Device

Enable USB debug on your device this part is ignored here.
add a udev rules file that contains a USB configuration for each type of device you want to use for development.

$ sudo vi /etc/udev/rules.d/51-android.rules

then add below to new created file:

SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev" 

In this example, the vendor ID “0bb4” is for HTC. The MODE assignment specifies read/write permissions, and GROUP defines which Unix group owns the device node.
here need to replace with your mobile Phone manufacturers’ code.
You can get it from :https://developer.android.com/studio/run/device.html.

$ sudo chmod a+r /etc/udev/rules.d/51-android.rules

then ,reboot your mobile phone and ubuntu.

refer https://developer.android.com/studio/run/device.html

0 0
原创粉丝点击