首页 / 操作系统 / Linux / 32位Ubuntu编译Android 4.0.4问题
问题一:在32位Ubuntu 12.04上编译Android4.0.4源码时,出现了关于emulator的错误,关键是其Makefile里的-m64参数,将其用-m32代替即可,错误提示如下:ERROR: prebuilts/tools/gcc-sdk/../../gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/bin/x86_64-linux-gcc only run on 64-bit linuxmake: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/emulator64-target-arm_intermediates/tcg/tcg.o] Error 1涉及需要改的文件如下:external/qemu/Makefile.targetexternal/qemu/Makefile.common问题二:编译时出现如下提示:target Dex: coreError occurred during initialization of VMCould not reserve enough space for object heapCould not create the Java virtual machine.make: *** [out/target/common/obj/JAVA_LIBRARIES/core_intermediates/noproguard.classes-with-local.dex] Error 1查找build/core/definitions.mk文件发现如下内容:#TODO: use a smaller -Xmx value for most libraries;# only core.jar and framework.jar need a heap this big.# Avoid the memory arguments on Windows, dx fails to load for some reason with them.define transform-classes.jar-to-dex@echo "target Dex: $(PRIVATE_MODULE)"@mkdir -p $(dir $@)$(hide) $(DX) $(if $(findstring windows,$(HOST_OS)),,-JXms16M -JXmx2048M) --dex --output=$@ $(incremental_dex) $(if $(NO_OPTIMIZE_DX), --no-optimize) $(if $(GENERATE_DEX_DEBUG), --debug --verbose --dump-to=$(@:.dex=.lst) --dump-width=1000) $(PRIVATE_DX_FLAGS) $<endef由于我的电脑只有2GB的内容,那么上面的2048M肯定满足不了,因为linux分配时还需分配给内核内存,故将该参数调小为1024M。继续编译还会出现一些关于emulator的错误,而查阅了google官方资料,说是要在64bit系统上编译,换成64位的后,没出现什么错误,编译一切正常。更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2更多Android相关信息见Android 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=11本文永久更新链接地址