Setting Ubuntu16.04 environment for android

本文详细介绍在Linux环境下搭建SSH服务器、安装Git、配置Java环境、编译Android代码、设置Jack服务、安装调试工具及Samba共享等步骤,旨在为Android开发者提供全面的开发环境配置指南。

1, sudo apt-get install openssh-server

sudo service ssh restart

 

2, sudo apt install git

git config --global user.name "xxx"

git config --global user.email xx.xxxxx@xxx.com

git config --global core.editor vim

 

3, clone some useful git

git clone https://github.com/damonkohler/sl4a.git

 

4, clone and sync android aosp code

sudo apt-get install vim

sudo apt install curl

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/repo

chmod a+x ~/repo

mkdir maddev_o-ear

cd maddev_o-ear/

./repo init -u https://android.googlesource.com/platform/manifest

./repo sync

 

5, setup java environment (install java)

sudo apt-get update

sudo apt-get install openjdk-8-jdk

 

6, compile android code (need lzop at first)

sudo apt-get update

sudo apt-get install lzop

sudo apt-get install device-tree-compiler

sudo apt-get install m4

sudo apt-get install bison

sudo apt-get install  g++-multilib gcc-multilib lib32ncurses5-dev lib32z1-dev

sudo apt-get install  libxml2-utils

 

7, change java setting

zhangbo@OptiPlex-7020:~/maddev_o-ear/prebuilts/sdk/tools$ vi jack-admin

diff --git a/tools/jack-admin b/tools/jack-admin

index 96a4dc3..abc5bba 100755

--- a/tools/jack-admin

+++ b/tools/jack-admin

@@ -484,7 +484,7 @@ case $COMMAND in

     if [ "$RUNNING" = 0 ]; then

       echo "Server is already running"

     else

-      JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $LAUNCHER_NAME"

+      JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -Xmx2048M -cp $LAUNCHER_JAR $LAUNCHER_NAME"

       echo "Launching Jack server" $JACK_SERVER_COMMAND

       (

         trap "" SIGHUP

 

Change the jack server setting(port number) to others if exist other project in the same server:

vi ~/.jack-settings

vi ~/.jack-server/config.properties

SERVER_PORT_SERVICE=8076

SERVER_PORT_ADMIN=8077

jack.server.service.port=8076

jack.server.admin.port=8077

 

ps axu |grep jack

jack-admin kill-server

cd prebuilts/sdk/tools && touch jack && cd ../../../

jack-admin start-server

 

8, install useful tools

sudo apt install ckermit

vi ~/.kermrc

set line /dev/ttyUSB1

set speed 115200

set carrier-watch off

set handshake none

set flow-control none

robust

set file type bin

set file name lit

set rec  pack 1000

set send pack 1000

set window 5

Connect and open console:

kermit -c

Enter command line mode:

[Ctrl]\

Quit in command line mode:

Exit

 

sudo apt-get install samba

sudo apt-get install smbclient

sudo vi /etc/samba/smb.conf

[share]

comment=this is Linux share directory

path=/home/zhangbo

available = yes

browseable = yes

public=yes

writable=yes

create mask = 0644

directory mask =0777

force user = zhangbo

force group = zhangbo

 

Create samba account (must be an account exist in system):

sudo touch /etc/samba/smbpasswd

sudo smbpasswd -a zhangbo

 

sudo /etc/init.d/samba start

sudo /etc/init.d/samba stop

sudo /etc/init.d/samba restart

 

9, install download and debug tools:

sudo apt install android-tools-fsutils

sudo apt install android-tools-adb

sudo apt install android-tools-fastboot

sudo adb kill-server

sudo adb devices

 

8, download error: simg2img: command not found******not work

sudo apt install android-tools-fsutils

 

9, set system time

tzselect

sudo date -s "2017-08-08 14:22:00"

[sudo cp /usr/share/zoneinfo/Asia/ShangHai /etc/localtime  ]

转载于:https://my.oschina.net/u/3583648/blog/1505041

Ubuntu WSL refers to the integration of the Ubuntu operating system within the Windows Subsystem for Linux (WSL). WSL is a compatibility layer provided by Microsoft that allows users to run Linux binary executables natively on Windows 10, Windows 11, and Windows Server 2019. This means users can enjoy the benefits of the Ubuntu Linux environment, such as its command - line tools, development utilities, and open - source software ecosystem, directly on their Windows machines without the need for a full - fledged virtual machine or dual - booting setup. ### Installation - **Setting WSL2 as the default**: Use the command `wsl --set - default - version 2` to set WSL2 as the default version for future Linux distributions installed via WSL [^1]. - **Installing Ubuntu**: - List available Ubuntu distributions with `wsl --list --online`. - Install the default version of Ubuntu using `wsl --install`. - For a specific version like Ubuntu - 20.04, use `wsl --install -d Ubuntu - 20.04` [^1]. - Another option is to download Ubuntu 22.04.2 LTS from the Microsoft Store, which is faster and can avoid the process of converting from Ubuntu 20.04 to 22.04 after a wsl - based installation [^4]. - **Installing multiple Ubuntu instances**: The process involves installing the latest Ubuntu in WSL2, downloading a WSL2 - compatible Ubuntu compressed package, installing a second Ubuntu instance, logging in, setting user accounts, setting the default user, and then logging in with the new account [^2]. - **Installing Ubuntu 16.04 on Windows using WSL**: First, update WSL with `wsl --update`, and then import the root file system using `wsl --import Ubuntu - 16.04 C:\WSL\Ubuntu - 16.04 <downloaded rootfs file path>` [^3]. ### Configuration - **WSL/Ubuntu + Docker configuration**: Downloading Ubuntu 22.04.2 LTS from the Microsoft Store can simplify the installation process and avoid some conversion steps [^4]. - **Using CUDA in WSL Ubuntu for AI inference and training**: Add the following lines to `~/.bashrc` or `~/.zshrc` depending on the shell in use: ```bash export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH ``` This configures the environment variables for CUDA usage [^5].
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值