首页 > 代码库 > 签名和混淆(二)

签名和混淆(二)

一、问题

在使用eclipse对apk进行签名打包是,console界面出现下面的异常信息,导致打包失败:

[2014-07-15 23:57:43 - MozMeet] Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
[2014-07-15 23:57:43 - MozMeet] Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
[2014-07-15 23:57:43 - MozMeet] Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkUrlFactory
[2014-07-15 23:57:43 - MozMeet] Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
[2014-07-15 23:57:43 - MozMeet] Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
[2014-07-15 23:57:43 - MozMeet] Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
[2014-07-15 23:57:43 - MozMeet] Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkUrlFactory
[2014-07-15 23:57:43 - MozMeet] Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkUrlFactory
[2014-07-15 23:57:43 - MozMeet] Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkUrlFactory
[2014-07-15 23:57:43 - MozMeet] Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkUrlFactory
[2014-07-15 23:57:43 - MozMeet] Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
[2014-07-15 23:57:43 - MozMeet] Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
[2014-07-15 23:57:43 - MozMeet] Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
[2014-07-15 23:57:43 - MozMeet]       You should check if you need to specify additional program jars.
[2014-07-15 23:57:43 - MozMeet] Warning: there were 95 unresolved references to classes or interfaces.
[2014-07-15 23:57:43 - MozMeet]          You may need to specify additional library jars (using '-libraryjars').
[2014-07-15 23:57:43 - MozMeet] Error: Please correct the above warnings first.  
二、原因:取消注释proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt这行,使用混淆打包时出现的。

三、解决办法:

在proguard-project.txt混淆配置中,增加下面的代码:

-keepattributes SourceFile,LineNumberTable
-keep class com.parse.*{ *; }
-dontwarn com.parse.**
-dontwarn com.squareup.picasso.**
-keepclasseswithmembernames class * {
    native <methods>;
}

参考出处:http://stackoverflow.com/questions/24765588/proguard-cannot-find-referenced-libraries



签名和混淆(二)