최근 리눅스(우분투 13.04)에 안드로이드 빌드 환경을 구성하여 풀소스 빌드를 진행하고있는데,
갑자기 이 에러가 발생해서 -_- 하루종일 이놈 잡느라 정신이 없었네요. 보통 다음과 같은 패턴을 띄고 있습니다.
packages/apps/Email/emailcommon/src/com/android/emailcommon/utility/SSLUtils.java:35: cannot access javax.net.ssl.KeyManager
bad class file: javax/net/ssl/KeyManager.class(javax/net/ssl:KeyManager.class)
unable to access file: corrupted zip file
Please remove or make sure it appears in the correct subdirectory of the classpath.
import javax.net.ssl.KeyManager;
^
Processing target/product/generic/obj/APPS/PhotoTable_intermediates/package.apk
make: *** [out/target/common/obj/JAVA_LIBRARIES/com.android.emailcommon_intermediates/classes-full-debug.jar] Error 41
구글링을 해보면 다양한 해결책이 나옵니다. 그 중 시도해 봤던 것이
JDK버전 올리기였는데 (1.6.0_24에서 1.6.0_45로), 똑같더군요 -_-
여러 삽질을 거듭한 끝에 결국 찾아냈습니다. 바로 원인은 jar 때문....
구글 그룹스의 질문 글 답변 에서 원하는 답을 얻었습니다.
답변 글 중 해결책이 된 답변 중 일부를 보면 아래와 같습니다.
Not a classpath problem- and the error codes aren't in the least bit helpful or self-explanatory (I can relate here... :-D ) . I had the same problem building a build from OMAPedia for the Blaze as a dry run for something else. A bit of initial digging led me here. A bit stronger/deeper use of Google-fu led me to one of the android dev lists archived on OSDir.
There's this nifty little tool called "fastjar", written in C, that at least Ubuntu 10.10 provides and selects the main "alternative" for jar tasks as it's up to 100 times faster than the Java based jar tool,
even if it's not complete when compared to the java jar tool. It typically produces "usable" jar files...well, at least for Java
runtimes, that is...
Unfortunately, while the jar is "corrupt" as far as the jar to dex conversion, it's not corrupt in the normal sense of things, meaning the file's openable, etc.- and it doesn't really tell you WHICH file is "corrupted" so you could do a comparison/analysis.
Long story short, run "sudo update-alternatives --config jar" and select the corresponding jar tool from the 1.6 JDK you're using. This should fix things enough for you to do a clean build of things at that point.
즉, 우분투에 기본으로 내장되어 있는 fastjar를 통해 jar 패키징을 하여 불완전한 패키지가 생기게 되고,
이 때문에 dex로 컨버팅할 때 오류가 발생하는 것입니다.
따라서, 이를 해결하려면 update-alternatives를 사용하여
JDK에서 제공하는 jar 툴을 사용하도록 변경해야 합니다.
터미널에서 sudo update-alternatives --config jar를 입력하면,
다음과 같이 시스템에 설치되어 있는 jar 툴들이 표시됩니다.
현재 fastjar을 사용하도록 선택되어 있기 때문에 오류가 발생했던 것이죠.
kunny@andronux:~$ sudo update-alternatives --config jar
There are 2 choices for the alternative jar (providing /usr/bin/jar).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/fastjar 100 auto mode
1 /usr/bin/fastjar 100 manual mode
2 /usr/lib/jvm/java-6-sun/bin/jar 63 manual mode
Press enter to keep the current choice[*], or type selection number:
위 화면에서 JDK에서 제공하는 jar를 선택하면 오류를 해결할 수 있습니다. (위 경우는 2번을 선택)
'AOSP' 카테고리의 다른 글
다른 작업환경에서 replacement 패치 업로드하기 ('no branches ready for upload' 해결하기) (0) | 2013.10.30 |
---|---|
Android Studio, ADT 플러그인 빌드하기 (0) | 2013.10.28 |
안드로이드 SDK 빌드시 create_all_symlinks.sh에러 에러가 날 때 (3) | 2013.10.17 |
이클립스에서 안드로이드 시스템 앱 빌드하기 (22) | 2012.10.03 |
Mac OS X 10.7 (Lion) 에서 안드로이드 빌드환경 설정하기 (8) | 2012.08.07 |