天天看點

android 打包遇到的問題

說說我進早上打包遇到的幾個問題吧,首先我使用build-->generate signed apk然後輸入簽名打包,啪,給我報了一個錯。

1,debug-stripped.ap_' specified for property 'resourcefile' does not exist.

android 打包遇到的問題

這什麼錯,怎麼一起沒遇到過,馬上度娘,找了半天找到一個和我很相似的,意思是android studio更新到2.2之後出現的錯誤,于是我也嘗試了一把下面的方法:

file—>settings,打開settings界面,搜尋到instant run。

android 打包遇到的問題

,2怎麼我的預設就是沒選中的啊,于是看第二條,有人說是debug模式下的混淆開關問題。

android 打包遇到的問題

好我都把你改了,debug我都false行了吧,形如:

android 打包遇到的問題

buildtypes {  

    release {  

        minifyenabled true  

        shrinkresources true  

        proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'  

    }  

    debug {  

        minifyenabled false  

        shrinkresources false  

}  

3,我又重新編譯,結果報android studio 混淆打包 ioexception: please correct the above warnings first,形如下面的錯誤

android 打包遇到的問題

warning:org.apache.http.impl.conn.tsccm.routespecificpool: can't find referenced class org.apache.commons.logging.logfactory    

warning:org.apache.http.impl.conn.tsccm.routespecificpool: can't find referenced class org.apache.commons.logging.log    

warning:org.apache.http.impl.conn.tsccm.threadsafeclientconnmanager: can't find referenced class org.apache.commons.logging.logfactory    

warning:org.apache.http.impl.conn.tsccm.threadsafeclientconnmanager: can't find referenced class org.apache.commons.logging.log    

warning:org.apache.http.impl.conn.tsccm.threadsafeclientconnmanager$1: can't find referenced class org.apache.commons.logging.log    

warning:there were 210 unresolved references to classes or interfaces.    

         you may need to add missing library jars or update their versions.    

         if your code works fine without the missing classes, you can suppress    

         the warnings with '-dontwarn' options.    

         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)    

warning:there were 1 unresolved references to library class members.    

         you probably need to update the library versions.    

         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)    

:app:proguardrelease failed    

error:execution failed for task ':app:proguardrelease'.    

> java.io.ioexception: please correct the above warnings first.    

好吧,我打開混淆檔案(proguard-rules),首先我看到有人把下面的ignorewarning注釋了,我擦,然後關閉,打包成功,不過這裡加上下面的一段話

android 打包遇到的問題

打包報錯java.io.ioexception: please correct the above warnings first.  

-dontwarn org.apache.http.**  

android 打包遇到的問題

繼續閱讀