编译源码时,Android can only be built by versions 3.81 and 3.82解决方法

在编译源码时,出现如下错误:

build/core/main.mk:45: ********************************************************************************
build/core/main.mk:46: *  You are using version 4.1 of make.
build/core/main.mk:47: *  Android can only be built by versions 3.81 and 3.82.
build/core/main.mk:48: *  see https://source.android.com/source/download.html
build/core/main.mk:49: ********************************************************************************
build/core/main.mk:50: *** stopping.  Stop.
#### make failed to build some targets  ####、

这是因为对于Android低版本,如android 4.4,只能使用make 3.8进行编译,解决方式有两种:
1.卸载当前make 4.1,安装make3.82,如果卸载4.1了,那么在编译高版本源码时,又必须重新安装,因此不推荐这种方式;
2.修改build/core/main.mk文件:
vi build/core/main.mk:

# Check for broken versions of make.
# (Allow any version under Cygwin since we don't actually build the platform there.)
ifeq (,$(findstring CYGWIN,$(shell uname -sm)))
ifeq (0,$(shell expr $$(echo $(MAKE_VERSION) | sed "s/[^0-9\.].*//") = 3.81))
ifeq (0,$(shell expr $$(echo $(MAKE_VERSION) | sed "s/[^0-9\.].*//") = 3.82))
#将这里修改为当前的4.1版本
ifeq (0,$(shell expr $$(echo $(MAKE_VERSION) | sed "s/[^0-9\.].*//") = 4.1))
$(warning ********************************************************************************)
$(warning *  You are using version $(MAKE_VERSION) of make.)
$(warning *  Android can only be built by versions 3.81 and 3.82.)
$(warning *  see https://source.android.com/source/download.html)
$(warning ********************************************************************************)
$(error stopping)
endif
endif
endif

你可能感兴趣的:(Android系统开发)