본문 바로가기
3. 개발 관련/정리 :: issue 와 resovle

[AOSP] java incorrect version error

by kyuho.choi 2016. 5. 4.
728x90
반응형


Android 를 빌드하다 보면 아래와 같은 에러가 가끔 나오는 데...

============================================
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.

Your version is: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar  java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode).
The required version is: "1.7.x"

Please follow the machine setup instructions at
    https://source.android.com/source/initializing.html
************************************************************
build/core/main.mk:174: *** stop.  Stop.

#### make failed to build some targets (1 seconds) ####


JAVA 가 안깔린 경우에는 직접 깔아서 사용하면 된다.


https://source.android.com/source/initializing.html


$ sudo apt-get update
$ sudo apt
-get install openjdk-8-jdk


문제는 JAVA 가 이미 설치되어 있는 환경에서도 위 에러가 나오는 경우가 있는데,

temporal 하게 강제로 빌드하는 방법은 아래와 같다.


android/build/core/main.mk

=================================================================

 156 ifeq ($(strip $(java_version)),)

 157 $(info ************************************************************)

 158 $(info You are attempting to build with the incorrect version)

 159 $(info of java.)

 160 $(info $(space))

 161 $(info Your version is: $(java_version_str).)

 162 $(info The required version is: $(required_version))

 163 $(info $(space))

 164 $(info Please follow the machine setup instructions at)

 165 $(info $(space)$(space)$(space)$(space)https://source.android.com/source/initializing.html)

 166 $(info ************************************************************)

 167 #$(error stop) # chlrbgh0

 168 endif

=================================================================


위와 같이 버전 체크에서 에러가 나는 경우 `error stop` 구문을 강제로 막아버리면 된다.
이는 물론 적당한 version의 java 가 설치되어 있고 build system 에서 찾지 못하는 경우에만 가능하다.


728x90
반응형

댓글