ubuntu 16.04 android开发,Ubuntu16.04 下 Android 开发环境

这篇博客详细介绍了如何配置Android开发环境,包括设置JDK环境变量,安装和配置Android SDK,以及使用Android NDK。还提到了C++11/14在NDK中的支持情况,并提供了错误解决建议。此外,文章还提供了在线和离线安装Android SDK的链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值