1. 程式人生 > >Building Android SDK build tools: aapt for Debian Arm

Building Android SDK build tools: aapt for Debian Arm

The Android SDK tools does not support building on Linux Arm.

I will show how to compile the build tools: aapt, aidl on a Debian Armhf (wheezy) device using the Android source.

I install Oracle 7 JDK jdk-7u51-linux-arm-vfp-hflt.tar.gz into /opt/java/jdk1.7.0_51
Though the latest version of Android in the Android Open Source Project (AOSP) requires OpenJDK 7 for Linux.

1     # update-alternatives --install /usr/bin/java java /opt/java/jdk1.7.0_51/bin/java 2000
2     # update-alternatives --install /usr/bin/javac javac /opt/java/jdk1.7.0_51/bin/javac 2000
3 

Refer to Installing required packages (Ubuntu) in Initializing a Build Environment for Linux.

My Debian Armhf device is My Cloud from Western Digital. You will need to enable SSH from the My Cloud dashboard. See

How to enable SSH (Secure Shell) on a WD My Cloud.

The installed libc6 is a newer version (2.17-97) than the official Debian wheezy libc6 (2.13-38+deb7u1). And because the Debian libc6-dev depends on libc6 (= 2.13-38+deb7u1) , it prevents libc6-dev from being installed. I install the libc6-dev package manually by extracting the files from the deb.

Then, using the equivs tools to build an empty libc6-dev package and install it to circumvent dependency checking.

 1     # apt-get install linux-libc-dev
 2     # dpkg -s libc6
 3     Package: libc6
 4     Status: install ok installed
 5     . . .
 6     Source: eglibc
 7     Version: 2.17-97
 8     . . .
 9 
10     # apt-get install equivs
11 

Modify the libc6-dev package control file to change its dependency to "Depends: libc6 (>= 2.13-38+deb7u1), linux-libc-dev"

1     Package: libc6-dev
2     Source: eglibc
3     Version: 2.13-38+deb7u1
4     Architecture: armhf
5     Maintainer: GNU Libc Maintainers <[email protected]>
6     Installed-Size: 7700
7     Depends: libc6 (>= 2.13-38+deb7u1), linux-libc-dev
8 

Install the empty libc6-dev deb that is built from equivs-build:

1     # equivs-build control
2     # dpkg -i libc6-dev_2.13-38+deb7u1_armhf.deb
3 

Install the other required packages for the build environment:

1     # apt-get install git gnupg flex bison gperf build-essential \
2      zip curl  libncurses5-dev x11proto-core-dev \
3      libx11-dev libreadline6-dev libgl1-mesa-glx libgl1-mesa-dev \
4      python-markdown libxml2-utils xsltproc zlib1g-dev
5 

Repo sync will take very long time to complete the download.

To save time, you do not have to download everything. Check the instruction on Build Overview - Android Tools.

To build a full SDK, run these commands in a bash shell: (This will throw errors on Linux Arm)

1     $ cd ~/android/src
2     $ . build/envsetup.sh
3     $ lunch sdk-eng
4     $ make sdk
5 

The following shows the changes required. (Change/addition is highlighted/bold)
Modify build/core/envsetup.mk to add detection of Arm architecture.

build/core/envsetup.mk (@ line 76)
   ifneq (,$(findstring Power,$(UNAME)))
           HOST_ARCH := ppc
   endif
   
   ifneq (,$(findstring arm,$(UNAME)))
           HOST_ARCH := arm
   endif
   
   BUILD_ARCH := $(HOST_ARCH)
   

Modify build/core/main.mk to allow using Oracle 7 JDK

build/core/main.mk (@ line 178)
   requires_openjdk := false
   ifeq ($(LEGACY_USE_JAVA6),)
   ifeq ($(HOST_OS), linux)
   ifneq ($(HOST_ARCH), arm)
   requires_openjdk := true
   endif
   endif
   endif
   

Add build/core/combo/HOST_linux-arm.mk to define the configuration for building on host Linux Arm. Download build/core/combo/HOST_linux-arm.mk

Add build/core/clang/HOST_arm.mk for building on host Linux Arm. Download build/core/clang/HOST_arm.mk

Modify build/core/combo/TARGET_linux-arm.mk (due to copying build/core/combo/include/arch/linux-arm/AndroidConfig.h to build/core/combo/include/arch/target_linux-arm/AndroidConfig.h and using the original AndroidConfig.h for host build)

build/core/combo/TARGET_linux-arm.mk (@ line 91)
   android_config_h := $(call select-android-config-h,target_linux-arm)
   

Modify build/core/combo/include/arch/linux-arm/AndroidConfig.h to use only for host build. Download build/core/combo/include/arch/linux-arm/AndroidConfig.h

Compiles the dependent libraries, ignoring errors for device build (it builds for both host and target/device together, seems like no option to build for host only)


   $ cd ~/android/src/external/expat
   $ mm
    . .
   $ cd ~/android/src/external/libpng
   $ mm
    . .
   $ cd ~/android/src/system/core/liblog
   $ mm
    . .
   $ cd ~/android/src/system/core/libutils
   $ mm
    . .
   $ cd ~/android/src/system/core/libcutils
   $ mm
    . .
   

   $ cd ~/android/src/build/libs/host
   $ mm
   $ cd ~/android/src/build/tools/acp
   $ mm
   

In external/zlib/Android.mk, I comment off other builds except for the BUILD_HOST_STATIC_LIBRARY part and BUILD_HOST_SHARED_LIBRARY part.


   $ cd ~/android/src/external/zlib
   $ vi Android.mk
   $ mm
   

In system/core/libziparchive/Android.mk, I comment off other builds except for the BUILD_HOST_STATIC_LIBRARY part.


   $ cd ~/android/src/system/core/libziparchive
   $ vi Android.mk
   $ mm
   

   $ cd ~/android/src/frameworks/base/libs/androidfw
   $ mm
    . .
   

To link bison in prebuilts, create dirs for prebuilts/misc/linux-arm/bison (used when building aidl)


   $ cd ~/android/src/prebuilts/misc/linux-arm/bison
   $ ln -s /usr/bin/bison .
   

After compiling aapt, the binary is found in out/host/linux-arm/bin
And compile aidl, and zipalign


   $ cd ~/android/src/frameworks/base/tools/aapt
   $ mm
    . .
   $ cd ~/android/src/frameworks/base/tools/aidl
   $ mm
    . .
   $ cd ~/android/src/build/tools/zipalign
   $ mm
   

http://www.timelesssky.com/blog/building-android-sdk-build-tools-aapt-for-debian-arm

相關推薦

Building Android SDK build tools: aapt for Debian Arm

The Android SDK tools does not support building on Linux Arm. I will show how to compile the build tools: aapt, aidl on a Debian Armhf (wh

License for package Android SDK Build-Tools 28.0.2 not accepted.(MAC)

這個問題是我在mac下搭建環境時出現的問題,中途查詢了許多資料很多朋友在做rn等其他一些跨平臺專案也遇見了這個問題,這裡說下我解決的方法; 1.進到sdk/tools/bin目錄下; 這個目錄的具體位置

android sdk build-tools platforms下載

android 開發sdk build-tools platforms等的下載 下載地址:http://mirrors.neusoft.edu.cn/android/repository/ android開發最新的包和工具都在這裡面可以下到。 Gradle Distributions

eclipse執行錯誤提示 Failed to load D:\Android\sdk\build-tools\26.0.0-preview\lib\dx.jar

前幾天在ecplise上執行專案還好好,今天一執行就提示這個錯誤:Your project contains error(s), please fix them before running your application.(你的程式包含錯誤,請修改後再執行)。咋

The specified Android SDK Build Tools version (23.0.2) is ignored,

The specified Android SDK Build Tools version (23.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2

升級到Android Studio 3.2.1,報The specified Android SDK Build Tools version (25.0.0) is ignored, as it is

升級到Android Studio 3.2.1 ,引入以前公司專案,報 The specified Android SDK Build Tools version (25.0.0) is ignored, as it is below the minimum supported versio

Android Studio解決 類似 sdk\build-tools\23.0.1\aapt.exe'' finished with non-zero exit value 1 這種問題

Error:Execution failed for task ':vjfen_app:processDebugResources'. > com.Android.ide.common.process.ProcessException: org.gradle.proc

AndroidStudio 報錯 “ Process 'command 'D:\SDK\build-tools\27.0.3\aapt.exe'' finished with non-zero ex”

一個AndroidStudio執行時的錯誤。 “Process 'command 'D:\SDK\build-tools\27.0.3\aapt.exe'' finished with non-zero exit value 1” 在網上都是在說是檢視出現問題了,但是說真的,如果去一個個檢查

Android:解決Failed to load D:\Android-Studio\sdk\build-tools\xx.xx.xx\lib\dx.jar

Eclipse遇到如下錯誤: [2018-11-04 18:11:46 - Dex Loader] Failed to load G:\Android Tools\android-sdk-w

安卓報Process 'command 'D:\SDK\AS\sdk\build-tools\23.0.0\aapt.exe'' finished with non-zero exit value 1

專案做了一個暑假,今晚要完工了,換了一張圖片,結果報了這個錯Process 'command 'D:\SDK\AS\sdk\build-tools\23.0.0\aapt.exe'' finished with non

SDK Build Tools revision (19.0.3) is too low for project Minimum required is 19.1.0

如果你正在使用Android Studio工具進行開發,且將版本更新到0.6.0的時候,莫名的出現這樣的錯誤 SDK Build Tools revision (19.0.3) is too low for project 。。。Minimum required is

AndroidStudio 中的 Android plugin version與Gradle version、SDK Build Tools之間的關係

先推薦一下google在中國合法且訪問迅速的網站 google開發者網站(中國) 首先 android plugin version 理解成gradle 的android 外掛版本 gradle versin 就是gradle自己本身的版本

Android Gradle外掛(plugin)版本(version)與Gradle、SDK Build Tools版本關係

具體關係如下圖: 比如,Android Studio 2.0釋出,其中有個新功能“Instant Run”,需要Android Gradle Plugin版本2.0.0以上,那麼我們專案的.gradle檔案就需要以下配置 buildscript { depe

sdk build tools 25.0.0編譯依賴glibc2.14

報錯資訊:/build-tools/25.0.0/aapt:** /lib64/libc.so.6: version GLIBC_2.14’ not found (required by /var/lib/jenkins/tools/android-sdk/build-tools/25

C:\Users\zhen\AppData\Local\Android\Sdk\platform-tools\adb'' finished with non-zero exit value 1

Android studio編譯時報錯 Process 'command 'C:\Users\zhen\AppData\Local\Android\Sdk\platform-tools\adb'' finished with non-zero exit value 1 只需要在setting

First Look at New Android Gradle Build Tools: The new DSL structure and Gradle 2.5

Android Studio 1.3's stage is closed to the stable release. New features are keep coming including full NDK support. And it seems like so

Android SDKtools詳解

Android SDK包含了各種各樣的定製工具,簡介如下: Android模擬器(Android Emulator) 它是在你的計算機上執行的一個虛擬移動裝置。你可以使用模擬器來在一個實際的Android執行環境下設計,除錯和測試你的應用程式。 Android除錯橋(A

Android SDKtools 目錄下的工具介紹

Android SDK包含了各種各樣的定製工具,簡介如下: Android模擬器(Android Emulator )它是在你的計算機上執行的一個虛擬移動裝置。你可以使用模擬器來在一個實際的Android執行環境下設計,除錯和測試你的應用程式。 Android除錯橋(Android Debug Bridge

android-sdk-windows\build-tools\26.0.0\aapt.exe'' finished with non-zero exit value 1

android-sdk-windows\build-tools\26.0.0\aapt.exe’’ finished with non-zero exit value 1 沒改動程式碼,專案編譯的時候報了這個錯誤 com.android.ide.common.p

Android編譯時出現Process 'command 'build-tools\27.0.3\aapt.exe'' finished with non-zero exit value 1報錯

首先說下自己的解決方案: 1,電腦當時執行的記憶體不夠,導致了這個問題 2,這個才是重點 AndroidManifest.xml資原始檔中引用有錯誤(搜狗渠道的資源配置引用了愛遊戲渠道的資源配置)刪除錯誤的資源配置就可以了,資源報錯的方式是通過以下一篇部落格