bad class file magic (1f8b0800) or version (0000.0000)错误解决

     android项目中,引入了别人写的第三方jar包,老是报一下的错误:

Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (1f8b0800) or version (0000.0000)
	at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
	at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
	at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
	at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
	at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
	at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
	at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
	at com.android.dx.command.dexer.Main.processClass(Main.java:749)
	... 33 more
[2016-08-24 10:16:46 - ceshiapk] Dx 1 error; aborting
[2016-08-24 10:16:46 - ceshiapk] Conversion to Dalvik format failed with error 1
[2016-08-24 10:17:33 - ceshiapk] Proguard returned with error code 1. See console
[2016-08-24 10:17:33 - ceshiapk] java.io.IOException: Can't read [E:\workspace\feib-android\ceshiapk\libs\Listed-CSTSv3-ClientAPI-ce333shi.jar] (Can't process class [com/IIG/InnerI.class] (Invalid magic number [1f8b0800] in class))
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.InputReader.readInput(InputReader.java:230)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.InputReader.readInput(InputReader.java:200)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.InputReader.readInput(InputReader.java:178)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.InputReader.execute(InputReader.java:78)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.ProGuard.readInput(ProGuard.java:196)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.ProGuard.execute(ProGuard.java:78)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.ProGuard.main(ProGuard.java:492)
[2016-08-24 10:17:33 - ceshiapk] Caused by: java.io.IOException: Can't process class [com/IIG/InnerI.class] (Invalid magic number [1f8b0800] in class)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.io.ClassReader.read(ClassReader.java:112)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.io.JarReader.read(JarReader.java:65)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.InputReader.readInput(InputReader.java:226)
[2016-08-24 10:17:33 - ceshiapk] 	... 6 more
[2016-08-24 10:17:33 - ceshiapk] Caused by: java.lang.UnsupportedOperationException: Invalid magic number [1f8b0800] in class
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.classfile.util.ClassUtil.checkMagicNumber(ClassUtil.java:47)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.classfile.io.ProgramClassReader.visitProgramClass(ProgramClassReader.java:79)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
[2016-08-24 10:17:33 - ceshiapk] 	at proguard.io.ClassReader.read(ClassReader.java:91)
[2016-08-24 10:17:33 - ceshiapk] 	... 11 more

         我各种谷歌百度,都说是编译环境不一致的问题,但请仔细看version(000000),并没有说是jdk版本的问题,提示的错误很明显是java的class损坏,无法识别,最后纠结了将近两个礼拜,才知道原来这个jar包,先前的经理为了防止别人篡改,这个类本身就不是java的class,只是取了一个名字而已,导致android 在真机运行时,无法将第三方的jar包打到apk中,记录一下,这是一个很大的坑.

    注意: -==============================================分割线==========================================================

    你使用别人给的jar的时候,大多数只会提示bad class file,但并不会提示你哪个class损坏或者有问题的,所以我有一个比较绕的方法就是使用混淆android工程代码,当混淆出错的时候,就会具体指向哪个class无法进行混淆,这样你就知道哪个jar包出错了,如下图:


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值