简体   繁体   中英

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/APPS/Calculator_intermediates/classes-full-debug.jar] Error 41

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM