我已将ProGuard添加到我的项目中并收到此错误。我想它可以是Jsoup lib,我用来发送POST和GET请求并解析响应。
没有单独的行可以抛出此异常。
你能用ProGuard帮我解决这个问题吗?
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:864)
Caused by: java.lang.ExceptionInInitializerError
at org.jsoup.nodes.Document$OutputSettings.<init>(Unknown Source)
at org.jsoup.nodes.Document.<init>(Unknown Source)
at org.jsoup.parser.TreeBuilder.void initialiseParse(java.lang.String,java.lang.String,org.jsoup.parser.ParseErrorList)(Unknown Source)
at org.jsoup.parser.TreeBuilder.org.jsoup.nodes.Document parse(java.lang.String,java.lang.String,org.jsoup.parser.ParseErrorList)(Unknown Source)
boolean process(org.jsoup.parser.Token)
at org.jsoup.parser.HtmlTreeBuilder.org.jsoup.nodes.Document parse(java.lang.String,java.lang.String,org.jsoup.parser.ParseErrorList)(Unknown Source)
boolean process(org.jsoup.parser.Token)
boolean process(org.jsoup.parser.Token,org.jsoup.parser.HtmlTreeBuilderState)
void transition(org.jsoup.parser.HtmlTreeBuilderState)
org.jsoup.parser.HtmlTreeBuilderState state()
void framesetOk(boolean)
void maybeSetBaseUri(org.jsoup.nodes.Element)
org.jsoup.nodes.Element insert(org.jsoup.parser.Token$StartTag)
org.jsoup.nodes.Element insert(java.lang.String)
void insert(org.jsoup.parser.Token$Comment)
void insert(org.jsoup.parser.Token$Character)
boolean isElementInQueue(org.jsoup.helper.DescendableLinkedList,org.jsoup.nodes.Element)
void popStackToClose(java.lang.String[])
void insertOnStackAfter(org.jsoup.nodes.Element,org.jsoup.nodes.Element)
void replaceInQueue(java.util.LinkedList,org.jsoup.nodes.Element,org.jsoup.nodes.Element)
boolean inSpecificScope(java.lang.String,java.lang.String[],java.lang.String[])
boolean inSpecificScope(java.lang.String[],java.lang.String[],java.lang.String[])
boolean inScope(java.lang.String,java.lang.String[])
void insertInFosterParent(org.jsoup.nodes.Node)
at org.jsoup.parser.Parser.org.jsoup.nodes.Document parseInput(java.lang.String,java.lang.String)(Unknown Source)
boolean isTrackErrors()
at org.jsoup.helper.DataUtil.org.jsoup.nodes.Document parseByteData(java.nio.ByteBuffer,java.lang.String,java.lang.String,org.jsoup.parser.Parser)(Unknown Source)
java.nio.ByteBuffer readToByteBuffer(java.io.InputStream,int)
java.lang.String getCharsetFromContentType(java.lang.String)
at org.jsoup.helper.HttpConnection$Response.org.jsoup.nodes.Document parse()(Unknown Source)
at com.ThreeBoots.api.API.java.lang.Object userLogin(java.lang.String,java.lang.String)(Unknown Source)
java.lang.Object userLoginFacebook(java.lang.String)
boolean userLogout()
boolean saveArticle(com.ThreeBoots.database.Article)
java.lang.String loadPhoto(android.graphics.Bitmap)
java.lang.String loadPhoto(android.widget.ImageView)
java.lang.Object userSaveProfile(java.lang.String,java.lang.String,java.lang.String)
java.lang.String sendRequest(java.lang.String,java.lang.String[])
java.lang.String sendImageLoadRequest(java.lang.String,android.graphics.Bitmap)
void processingBrands(org.json.JSONObject)
java.lang.Object getListFromJSON(java.lang.Class,org.json.JSONArray)
void insert(java.lang.Class,java.lang.Object)
at com.ThreeBoots.api.API.java.lang.Object userRegister(java.lang.String,java.lang.String)(Unknown Source)
boolean sync()
java.lang.String sendRequest(java.lang.String)
void processingMaterials(org.json.JSONObject)
at com.ThreeBoots.api.API.java.lang.Object userRegister(java.lang.String,java.lang.String)(Unknown Source)
boolean sync()
java.lang.String sendRequest(java.lang.String)
void processingMaterials(org.json.JSONObject)
at com.ThreeBoots.asyncs.RequestAsync.java.lang.Object doInBackground(java.lang.String[])(Unknown Source)
void asyncSaveArticlePostExecute(java.lang.Boolean)
void asyncRegistrationPostExecute(java.lang.Object)
void startMainActivity()
void startLoginActivity(android.app.Activity)
at com.ThreeBoots.asyncs.RequestAsync.java.lang.Object doInBackground(java.lang.Object[])(Unknown Source)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
... 5 more
Caused by: java.lang.ExceptionInInitializerError
at org.jsoup.nodes.Entities$EscapeMode.<clinit>(Unknown Source)
... 20 more
Caused by: java.lang.NullPointerException
at java.util.Properties.load(Properties.java:246)
at org.jsoup.nodes.Entities.java.util.Map loadEntities(java.lang.String)(Unknown Source)
at org.jsoup.nodes.Entities.<clinit>(Unknown Source)
... 21 more
答案 0 :(得分:4)
不要在proguard中添加解析类以获得混淆。 保持原样。在proguard文件中写下以下行
-keep class yourclassname.** { *; }
答案 1 :(得分:1)
Proguard已经跳过了一些所需的文件,执行此操作
-keep <your calss name>.** {
*;
}
这将确保proguard在混淆时不会跳过它们