Ubuntu16.04 下 Android 开发环境
程序员文章站
2022-03-25 08:22:24
文章目录OverviewJDKAndroid SDKtoolsandroidddmsemulatormksdcardplatform-toolsadbAndroid NDKtoolchains (Cross-Compilation tools)NDK TipsAndroid ProjectAnt ProjectEclipseAndroid Studio (AS)Overviewin ~/.bashrc(or /etc/profile or /etc/environment)export JAVA_HO...
文章目录
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
- windows:
- Android SDK开发包国内下载地址
tools
android
-
Android SDK Manager
android
-
android list
android list [targets]
-
update tools
[tsocks] android update sdk -u
ddms
- DDMS
ddms
emulator
- emulator
emulator
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 Antandroid 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.csdn.net/u011178262/article/details/107968691
推荐阅读
-
Android开发之splash界面下详解及实例
-
Android应用开发中模拟按下HOME键的效果(实现代码)
-
Android Studio配置Kotlin开发环境详细步骤
-
android开发环境配置,android开发环境的搭建步骤
-
使用Win10+Android+夜神安卓模拟器,搭建ReactNative开发环境
-
安卓开发环境配置有哪些方法,android开发环境的搭建步骤
-
Android 开发环境配置问题
-
Android NDK开发之:配置环境的详解
-
解决Fedora14下eclipse进行android开发,ibus提示没有输入窗口的方法详解
-
Fedora14下android开发: eclipse与ibus确有冲突的问题分析