Overview
in ~/.bashrc(or /etc/profile or /etc/environment)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版本
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
tools
android
Android SDK Manager
android
android list
android list [targets]
update tools
[tsocks] android update sdk -u
ddms
DDMSddms
emulator
emulatoremulator
mksdcard
platform-tools
adb
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
ndk-build -j4
toolchains (Cross-Compilation tools)
compilers
arm-linux-androideabi-g++
arm-linux-androideabi-gcc
check .so file
arm-linux-androideabi-readelf -d *.so
NDK Tips
Android NDK 从2013年开始支持了C++11,从2015年开始支持C++14,在 Android.mk 中加入
# c++ 11 标准
LOCAL_CPPFLAGS += -std=c++11
LOCAL_CPPFLAGS += -D__cplusplus=201103L
# or
# c++ 14 标准
LOCAL_CPPFLAGS += -std=c++1y
LOCAL_CPPFLAGS += -D__cplusplus=201300L
When compiling c++ code with -std=c++11 and using gnustl_shared, many C99 math functions are not provided by the header as they should. At this time,APP_STL := c++_static may help.(from Issue: C++11 cmath functions not in std namespace)
NDK Logcat:
crash keywords
--------- beginning of crash
backtrace
Android Project
Ant Project
install ant
sudo apt install ant
generate build.xml for Ant
android update project -t android-23 -p .
build ant project (SDK Build-tools and SDK Platform need to be installed)
ant debug/release
Eclipse
Eclipse
Eclipse IDE for Java Developers
ADT
online install: https://dl-ssl.google.com/android/eclipse/
offline install: Location:jar:file:ADT-23.0.7.zip
EGit
online install: http://download.eclipse.org/egit/updates/
Android Studio (AS)
本文地址:https://blog.youkuaiyun.com/u011178262/article/details/107968691