码迷,mamicode.com
首页 > 移动开发 > 详细

PhoneGap/Cordova Android应用签名发布注意事项

时间:2014-07-26 02:58:36      阅读:316      评论:0      收藏:0      [点我收藏+]

标签:cordova   phonegap   发布   proguard   

今天终于要发布Android HybirdApp了,安装以前做原生应用的流程发布签名Apk,没想到马上遇到了几个问题,现在把它们的解决办法整理下来。


export signed Apk 遇到下面错误,这个问题是多次读取inputStream导致的,貌似和eclise的自动编译有关,解决办法是关掉相关工程的自动编译。

Export Signed APK 前先將 Eclipse 的 Project -> Build Automatically关闭,第一个坑解决!

[2014-07-25 10:50:58 - SalesApp] Proguard returned with error code 1. See console
[2014-07-25 10:50:58 - SalesApp] java.io.IOException: Can't read [/Users/zhangxitao/work/salesapp/platforms/android/CordovaLib/bin/salesapp-cordovalib.jar] (Can't process class [com/squareup/okhttp/internal/spdy/SpdyConnection$Builder.class] (Unexpected end of ZLIB input stream))
[2014-07-25 10:50:58 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:232)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:202)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:180)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.InputReader.execute(InputReader.java:78)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.ProGuard.readInput(ProGuard.java:196)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.ProGuard.execute(ProGuard.java:78)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.ProGuard.main(ProGuard.java:483)
[2014-07-25 10:50:58 - SalesApp] Caused by: java.io.IOException: Can't process class [com/squareup/okhttp/internal/spdy/SpdyConnection$Builder.class] (Unexpected end of ZLIB input stream)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.io.ClassReader.read(ClassReader.java:112)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.io.JarReader.read(JarReader.java:65)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:228)
[2014-07-25 10:50:58 - SalesApp] 	... 6 more
[2014-07-25 10:50:58 - SalesApp] Caused by: java.lang.RuntimeException: Unexpected end of ZLIB input stream
[2014-07-25 10:50:58 - SalesApp] 	at proguard.classfile.io.RuntimeDataInput.readInt(RuntimeDataInput.java:136)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.classfile.io.ProgramClassReader.visitProgramClass(ProgramClassReader.java:77)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
[2014-07-25 10:50:58 - SalesApp] 	at proguard.io.ClassReader.read(ClassReader.java:91)
[2014-07-25 10:50:58 - SalesApp] 	... 12 more
[2014-07-25 10:51:06 - SalesApp] Proguard returned with error code 1. See console
[2014-07-25 10:51:06 - SalesApp] java.io.IOException: Can't read [/Users/zhangxitao/work/salesapp/platforms/android/CordovaLib/bin/salesapp-cordovalib.jar] (Can't process class [com/squareup/okhttp/internal/http/HttpDate.class] (Unexpected end of ZLIB input stream))
[2014-07-25 10:51:06 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:232)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:202)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:180)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.InputReader.execute(InputReader.java:78)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.ProGuard.readInput(ProGuard.java:196)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.ProGuard.execute(ProGuard.java:78)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.ProGuard.main(ProGuard.java:483)
[2014-07-25 10:51:06 - SalesApp] Caused by: java.io.IOException: Can't process class [com/squareup/okhttp/internal/http/HttpDate.class] (Unexpected end of ZLIB input stream)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.io.ClassReader.read(ClassReader.java:112)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.io.JarReader.read(JarReader.java:65)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:228)
[2014-07-25 10:51:06 - SalesApp] 	... 6 more
[2014-07-25 10:51:06 - SalesApp] Caused by: java.lang.RuntimeException: Unexpected end of ZLIB input stream
[2014-07-25 10:51:06 - SalesApp] 	at proguard.classfile.io.RuntimeDataInput.readInt(RuntimeDataInput.java:136)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.classfile.io.ProgramClassReader.visitProgramClass(ProgramClassReader.java:77)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
[2014-07-25 10:51:06 - SalesApp] 	at proguard.io.ClassReader.read(ClassReader.java:91)
[2014-07-25 10:51:06 - SalesApp] 	... 12 more
[2014-07-25 10:51:20 - SalesApp] Proguard returned with error code 1. See console
[2014-07-25 10:51:20 - SalesApp] java.io.IOException: Can't read [/Users/zhangxitao/work/salesapp/platforms/android/CordovaLib/bin/salesapp-cordovalib.jar] (Can't process class [com/squareup/okhttp/internal/http/HttpTransport.class] (Unexpected end of ZLIB input stream))
[2014-07-25 10:51:20 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:232)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:202)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:180)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.InputReader.execute(InputReader.java:78)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.ProGuard.readInput(ProGuard.java:196)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.ProGuard.execute(ProGuard.java:78)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.ProGuard.main(ProGuard.java:483)
[2014-07-25 10:51:20 - SalesApp] Caused by: java.io.IOException: Can't process class [com/squareup/okhttp/internal/http/HttpTransport.class] (Unexpected end of ZLIB input stream)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.io.ClassReader.read(ClassReader.java:112)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.io.JarReader.read(JarReader.java:65)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:228)
[2014-07-25 10:51:20 - SalesApp] 	... 6 more
[2014-07-25 10:51:20 - SalesApp] Caused by: java.lang.RuntimeException: Unexpected end of ZLIB input stream
[2014-07-25 10:51:20 - SalesApp] 	at proguard.classfile.io.RuntimeDataInput.readInt(RuntimeDataInput.java:136)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.classfile.io.ProgramClassReader.visitProgramClass(ProgramClassReader.java:77)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
[2014-07-25 10:51:20 - SalesApp] 	at proguard.io.ClassReader.read(ClassReader.java:91)
[2014-07-25 10:51:20 - SalesApp] 	... 12 more
[2014-07-25 10:54:53 - SalesApp] Proguard returned with error code 1. See console
[2014-07-25 10:54:53 - SalesApp] java.io.IOException: Can't read [/Users/zhangxitao/work/salesapp/platforms/android/CordovaLib/bin/salesapp-cordovalib.jar] (Can't process class [com/squareup/okhttp/internal/http/HttpEngine.class] (Unexpected end of ZLIB input stream))
[2014-07-25 10:54:53 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:232)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:202)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:180)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.InputReader.execute(InputReader.java:78)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.ProGuard.readInput(ProGuard.java:196)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.ProGuard.execute(ProGuard.java:78)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.ProGuard.main(ProGuard.java:483)
[2014-07-25 10:54:53 - SalesApp] Caused by: java.io.IOException: Can't process class [com/squareup/okhttp/internal/http/HttpEngine.class] (Unexpected end of ZLIB input stream)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.io.ClassReader.read(ClassReader.java:112)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.io.JarReader.read(JarReader.java:65)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.InputReader.readInput(InputReader.java:228)
[2014-07-25 10:54:53 - SalesApp] 	... 6 more
[2014-07-25 10:54:53 - SalesApp] Caused by: java.lang.RuntimeException: Unexpected end of ZLIB input stream
[2014-07-25 10:54:53 - SalesApp] 	at proguard.classfile.io.RuntimeDataInput.readInt(RuntimeDataInput.java:136)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.classfile.io.ProgramClassReader.visitProgramClass(ProgramClassReader.java:77)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
[2014-07-25 10:54:53 - SalesApp] 	at proguard.io.ClassReader.read(ClassReader.java:91)
[2014-07-25 10:54:53 - SalesApp] 	... 12 more


Proguard 会混淆cordova及其插件的java代码,导致apk运行时报 cordova error initial class,解决办法是在proguard-project.txt 加入下面的内容,不混淆cordova及其插件

cordova 3.0以上版本加

-keep class org.apache.cordova.** { *; }
-keep public class * extends org.apache.cordova.CordovaPlugin





PhoneGap/Cordova Android应用签名发布注意事项,布布扣,bubuko.com

PhoneGap/Cordova Android应用签名发布注意事项

标签:cordova   phonegap   发布   proguard   

原文地址:http://blog.csdn.net/offbye/article/details/38111385

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!