HtmlUnit / htmlunit-android

HtmlUnit packaged for Android
Apache License 2.0
35 stars 7 forks source link

请问我该如何写混淆规则 #15

Closed Matcha-xiaobin closed 1 year ago

Matcha-xiaobin commented 1 year ago

请问我该如何写混淆规则?

rbri commented 1 year ago

Can you please write in English ....

Matcha-xiaobin commented 1 year ago

I want to know how to write proguard-rules for this library

Matcha-xiaobin commented 1 year ago

I'm sorry, I used Google Translate, I don't know if the translation result can be understood. I ran into the following problem: When I packaged the release package, I encountered ClassNotFoundException: Didn't find class "org.apache.commons.logging.impl.LogFactoryImpl" on the phone

Matcha-xiaobin commented 1 year ago

version: 2.68.0-SNAPSHOT

Matcha-xiaobin commented 1 year ago

Caused by:org.apache.commons.logging.LogConfigurationException:java.lang.NullPointerException: Attempt to invoke virtual method'java.lang.Stringjava.lang.String.trim()'on a null object reference (Caused byjava.lang.NullPointerException:Attempt to invoke virtual method'java.lang.Stringjava.lang.String.trim()'on a null object reference) at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:40) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:3) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:1) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:1) at com.gargoylesoftware.htmlunit.WebClient.(WebClient.java:3)...13more Caused by:java.lang.NullPointerException:Attempt to invoke virtual method'java.lang.Stringjava.lang.String.trim()'on a null object reference at org.apache.commons.logging.impl.LogFactoryImpl.createLogFromClass(LogFactoryImpl.java:384) at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:127) at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:7)...17more

rbri commented 1 year ago

translation is ok - will have a look at this later

Matcha-xiaobin commented 1 year ago

Sorry to bother you, I have found a solution to this problem.

rbri commented 1 year ago

No problem...

@Matcha-xiaobin is there anything i can improve in the documentation to help others wit the same problem?

Matcha-xiaobin commented 1 year ago

No problem...

@Matcha-xiaobin is there anything i can improve in the documentation to help others wit the same problem?

Currently my workaround is:

Import dependency: "commons-logging:commons-logging:1.2" Although Gradle will prompt an error, but after packaging the release package, it will not appear that the LogFactory class cannot be found. Then write proguard-rules, adding the following sentences: -keep class org.apache. {*;} -keep class org.htmlunit.* {;} -keep class org.w3c. {*;} -keep class org.xml. {*;} -keep class com.gargoylesoftware.* {;} -keep class javax.xml. {*;} -keep class net.sourceforge.htmlunit.* {;} -keep class netscape.javascript.* {;}

After doing the above processing, the problem is solved. I hope it can help you, thank you!

rbri commented 1 year ago

ok, have at least added some info about the packages to the readme.