MiniDNS / minidns

DNS library for Android and Java SE
Other
215 stars 61 forks source link

App Crash #97

Closed eakteam closed 4 years ago

eakteam commented 5 years ago

Hi, everything was going fine before. After adding some native libs on my app it is throwing this exception :

Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: LdTb;
       at org.minidns.dnsserverlookup.AndroidUsingExec.isAvailable(AndroidUsingExec.java:61)
       at org.minidns.DnsClient.addDnsServerLookupMechanism(DnsClient.java:399)
       at org.minidns.DnsClient.(SourceFile:4)

I am using compileSdkVersion 28

Flowdalic commented 5 years ago

LdTb;

Is there some code obfuscation tool involved? Am I right to assume you are using MiniDNS 0.3.3?

eakteam commented 5 years ago

@Flowdalic The crash is happening on minidns-client:0.4.0-alpha3. Also i have checked to in my R8/Proguard rules, already added : -keep class org.minidns.dnsserverlookup.** , but it is still crashing, i don't know why.

The crash on firebase/crashlytics/logs says :

Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: LCv1;
       at org.minidns.dnsserverlookup.AndroidUsingExec.isAvailable(AndroidUsingExec.java:61)
       at org.minidns.DnsClient.addDnsServerLookupMechanism(DnsClient.java:399)
       at org.minidns.DnsClient.(SourceFile:4)
Caused by java.lang.ClassNotFoundException: Didn't find class "Cv1" on path: DexPathList[[
       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
       at org.minidns.dnsserverlookup.AndroidUsingExec.isAvailable(AndroidUsingExec.java:61)
       at org.minidns.DnsClient.addDnsServerLookupMechanism(DnsClient.java:399)
       at org.minidns.DnsClient.(SourceFile:4)
Flowdalic commented 5 years ago

Does it also crash if you completely disable ProGuard?

eakteam commented 5 years ago

@Flowdalic , when i am testing on debug mode, the crash don't happen immediately and not always. But sometimes yes it does crash Anyway as i said, i have added keep rules

eakteam commented 5 years ago

For Android > API 21 if i add on Application Class : DnsClient.addDnsServerLookupMechanism(AndroidUsingLinkProperties.setup(this) , it is crashing immediately when applying R8 or Proguard

It is weird because in rules i have added as i said : -keep class org.minidns.dnsserverlookup.** , but i will try -keep class org.minidns.dnsserverlookup.** { *; } and will get back to you again to see what happens

Flowdalic commented 5 years ago

when i am testing on debug mode, the crash don't happen immediately and not always. But sometimes yes it does crash

How does the (non-obfuscated) stacktrace look like if ProGuard is disabled?

eakteam commented 5 years ago

@Flowdalic I will try and will get back to this again. Thanks for your support. Also i will dissable obfuscation if it crash again to get more detailed crash report .

eakteam commented 5 years ago

@Flowdalic , when i apply R8/Proguard but adding this -dontobfuscate , it is not crashing anymore. I don't understand why because in fact even if i apply obfuscations still have added keep rules for -keep class org.minidns.dnsserverlookup.** { *; } and it should not obfuscate it.

I understand that this maybe is not bug of this library itself, but maybe something can be refactored to better function ?

Best Regards

eakteam commented 5 years ago

With obfuscation enabled this is my rules which everything works OK.

-keep, allowoptimizationclass org.minidns.dnsserverlookup.**
-keep, allowoptimization class org.minidns.DnsClient   //Adding this second line solve the issue

You can close this issue if nothing can be done through the library itself to better initialize classes