Android签名问题之Proguard returned with error code 1. See console
来源:互联网 发布:sql数据库基本语句 编辑:程序博客网 时间:2024/04/30 07:56
如果工程引入了android-support-v4的jar类库,那么在工程打包混淆时,就会出现报错提示。例如提示你:You may need to specify additional library jars (using '-libraryjars')。
这里先给出解决方案,稍后我们再来解释如何处理类似情况:
在proguard.cfg里的后面,添加如下内容:
- -libraryjars /android-support-v4.jar
- -dontwarn android.support.v4.**
- -keep class android.support.v4.** { *; }
- -keep public class *extends android.support.v4.**
- -keep public class *extends android.app.Fragment
然后你再打包看看,应该可以正常生成apk安装包了。
打包出错:
情况一:
"类1 can't find referenced class 类2" 字面上的意思就是类1找不到类2的引用;它会建议你:"You may need to specify additional library jars (using '-libraryjars').";
需要使用-libraryjars加上项目中使用到的第三方库就OK了。
例如:-libraryjars /android-support-v4.jar
注意:这里引用方式是当前工程的根目录(也可以配置其他目录),也就是说,你要把第三方jar放到当前目录下,否则就会警告说找不到jar文件!
情况二:
例如: can't find superclass or interface android.os.Parcelable$ClassLoaderCreator,碰到这样的情况,可以使用-dontwarn com.xx.yy.**,不对错误提出警告。
注意:使用这个方式的话,要确保自己没有用到这个库里面的类!否则就会抛ClassNotFoundException!
情况三:
在工程中确实用到了该类,采用上面方式还是不行。这个时候就要再增加一项:-keep class com.xx.yy.** { *;},让当前类不混淆。
小结:
对于引用第三方包的情况,可以采用下面方式避免打包出错:
-libraryjars /aaa.jar
-dontwarn com.xx.yy.**
-keep class com.xx.yy.** { *;}
最后打包成功,还要在机子上跑跑,看看有没有问题。
/*********************************************************************************************************/
如果引用第三方jar包。有时候会出现如下异常
You may need to specify additional library jars (using '-libraryjars').
该异常是说,你使用的第三方jar有问题,需引用,如下
#工程中用到的第三方包-libraryjars libs/gdx.jar
/************************************************************************************************************/
出现can't find referenced class的警告时,可以在proguard.cfg中添加-ignorewarnings来解决。
另外,对于有的第三方jar,可能已经进行过代码混淆了,在这里就要保持,例如百度的地图包jar。保持jar,避免混淆的代码如下:
-keep class com.baidu.mapapi.** {*;}
不混淆com.baidu.mapapi包中的所有代码,类名、方法、变量等。
- Android签名问题之Proguard returned with error code 1. See console
- Android混淆时出现的proguard returned with error code 1.See console问题
- Android Proguard returned with error code 1. See console 之注意事项
- 在签名生成apk文件时出现 Proguard returned with error code 1. See console
- Proguard returned with error code 1. See console解决办法”
- Proguard returned with error code 1. See console
- Proguard returned with error code 1. See console
- Proguard returned with error code 1. See console解决办法”
- Proguard returned with error code 1. See console
- Proguard returned with error code 1. see console
- Proguard returned with error code 1. See console
- Proguard returned with error code 1. See console解决办法”
- Proguard returned with error code 1. See console
- 混淆报错问题proguard returned with error code 1.See console
- Proguard returned with error code 1. See console 之 can't find
- android打包时报错Proguard returned with error code 1. See console
- Android打包失败Proguard returned with error code 1. See console
- Android打包失败Proguard returned with error code 1. See console
- java基础—对一个字符串中的数值进行从小到大的排序
- linux中使用pthread_kill函数测试线程是否存活的例子
- VMware Workstation 10.0 许可证密钥
- JS高级编程2-使用高阶函数
- 为什么hadoop要自己建立序列化框架
- Android签名问题之Proguard returned with error code 1. See console
- Android之Intent
- ls -l文件类型
- ajax乱码
- Django异常 - ImportError: No module named django.core.management
- JAVA基础教程入门教程(第四章到第六章)
- 宣布Office 2016 applications DLP 公共预览版
- [IOS]调用手机邮件系统发送邮件
- SpringAOP拦截Controller,Service实现日志管理(自定义注解的方式)