Ubuntu 16.04 下 Android 开发环境

Last updated on May 7, 2023 pm

[TOC]

Overview

  • in ~/.bashrc(or /etc/profile or /etc/environment)
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    export JAVA_HOME=/home/cg/tools/android_tools/jdk1.8.0_251
    export JRE_HOME=$JAVA_HOME/jre
    export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
    export PATH=$JAVA_HOME/bin:$PATH

    export ANDROID_SDK=/home/cg/tools/android_tools/android-sdk-linux
    export PATH=$ANDROID_SDK/tools:$PATH
    export PATH=$ANDROID_SDK/platform-tools:$PATH

    export ANDROID_NDK=/home/cg/tools/android_tools/android-ndk-r16b
    export PATH=$ANDROID_NDK:$ANDROID_NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH

JDK

  • 下载JDK包(例如,jdk-8u251-linux-x64.tar.gz)并解压

  • 配置环境变量

  • 查看java版本

    1
    2
    java -version
    javac -version

Android SDK

  • online install: http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
  • offline install:
    • windows: installer_r24.4.1-windows.exe
    • linux: android-sdk_r24.4.1-linux.tgz
  • Android SDK开发包国内下载地址

tools

android

  • Android SDK Manager

    1
    android

  • android list

    1
    android list [targets]

  • update tools

    1
    [tsocks] android update sdk -u

ddms

  • DDMS
    1
    ddms

emulator

  • emulator
    1
    emulator

mksdcard

platform-tools

adb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
adb help

adb shell

adb root
adb remount

adb start-server

adb devices
adb get-serialno

adb push/pull
adb install

adb logcat
adb bugreport

Android NDK

  • e.g., android-ndk-r14b, android-ndk-r16b-linux-x86_64.zip, etc.

  • ndk build

    1
    ndk-build -j4

toolchains (Cross-Compilation tools)

  • e.g. compilers

    1
    2
    arm-linux-androideabi-g++
    arm-linux-androideabi-gcc

  • others

    1
    arm-linux-androideabi-*

Android Project

Ant Project

  • install ant

    1
    sudo apt install ant

  • generate build.xml for Ant

    1
    android update project -t android-23 -p .

  • build ant project (SDK Build-tools and SDK Platform need to be installed)

    1
    ant debug/release

Eclipse

Android Studio (AS)

  • ubuntu 删除android studio
    • android-studio文件夹
    • ~/.AndroidStudio
    • ~/.android
    • ~/.local/share/applications/jetbrains-android-studio.desktop

Ubuntu 16.04 下 Android 开发环境
https://cgabc.xyz/posts/b6842b6b/
Author
Gavin Gao
Posted on
May 23, 2020
Licensed under