在32位的机器上编译Android

    技术2022-06-13  100

    从Android 2.2之后,编译需要在64位的环境下进行。

    如果想在32位的环境下编译,需要做一点修改。

     

    如下所示:

     

    1. 修改<src>/build/core/config.mk

    找到下面的代码,

    ifeq ($(HOST_OS),darwin) # Mac OS' screwy version of java uses a non-standard directory layout # and doesn't even seem to have tools.jar. On the other hand, javac seems # to be able to magically find the classes in there, wherever they are, so # leave this blank HOST_JDK_TOOLS_JAR := else HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh) endif

    在其后添加如下代码:

    # Is the host JDK 64-bit version? HOST_JDK_IS_64BIT_VERSION := ifneq ($(filter 64-Bit, $(shell java -version 2>&1)),) HOST_JDK_IS_64BIT_VERSION := true endif

    参见https://review.source.android.com/#patch,sidebyside,23134,1,core/config.mk

     

    2. 修改<src>/build/core/main.mk

    找到下面的代码,把它们注释掉,或删除掉。

    ifeq ($(BUILD_OS),linux) build_arch := $(shell uname -m) ifneq (64,$(findstring 64,$(build_arch))) $(warning ************************************************************) $(warning You are attempting to build on a 32-bit system.) $(warning Only 64-bit build environments are supported beyond froyo/2.2.) $(warning ************************************************************) $(error stop) endif endif

    参见https://review.source.android.com/#patch,sidebyside,23134,1,core/main.mk

     

    好了,现在就可以在32位的环境下进行编译了。


    最新回复(0)