开发者

Getting error while building android

For some days I used to build android successfully. But from last 2-3 days i was unable to build it. its giving some errors like:

packages/apps/Calculator/src/com/android/calculator2/CalculatorDisplay.java:19: cannot access android.content.Context bad class file: android/content/Context.class(android/content:Context.class) unable to access file: corrupted zip file Please remove or make sure it appears in the correct subdirectory of the classpath. import android.content.Context; ^ make: * [out/target/common/obj开发者_如何学JAVA/APPS/Calculator_intermediates/classes-full-debug.jar] Error 41


Have you tried to download it once more/or rebuild ? It may be really corrupted.


Please check if you are using Sun Java6 and associated jar tool to build Android.

$ sudo update-alternatives --config jar

Select the jar tool provided by the sun-java6-jdk instead of other jar tools like fastjar or openjdk jar.


This might just be for my use case, but I was copying the JAR from an external computer's shared directory and pasting it into my project.

Make sure that the JAR is copied from your computer, otherwise you will get the corrupted zip file issue with the JAR.

Hope this helps anyone who runs into this issue.


I was getting an error 41 purely because of a compile time error.

More specifically, I had a misnamed variable in the Settings app I was editing.

Found it, fixed it, and the error 41 went away and I built successfully.

I did do a "make update-api" before I found the typo. Not sure if this had any effect.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜