Open yuriisurzhykov opened 9 months ago
I've tried to add -dontwant flags for all packages for that I'm getting errors:
-dontwarn org.conscrypt.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**
-dontwarn com.aayushatharva.**
-dontwarn com.github.luben.**
-dontwarn com.google.protobuf.**
-dontwarn com.jcraft.**
-dontwarn com.ning.**
-dontwarn io.netty.**
-dontwarn net.jpountz.**
-dontwarn org.apache.log4j.**
-dontwarn org.jboss.log4j.**
-dontwarn org.slf4j.**
-dontwarn sun.security.**
I compiled, but then I get crash of my app, because of:
Caused by: java.lang.IllegalArgumentException: Can't find '[toLeakAwareBuffer]' in io.netty.buffer.AbstractByteBufAllocator
✅Ok, I don't know if its correct way to solve the problem, I don't like it, but at least it works now ✅.
So what I just did is beside of -dontwarn rules, I left and -keep rules for the same packages. So now the proguard-rules.pro
file looks like this:
-keep class io.netty.** { *; }
-keep class org.jctools.** { *; }
-keep class org.conscrypt.** { *; }
-keep class org.bouncycastle.** { *; }
-keep class org.openjsse.** { *; }
-keep class com.aayushatharva.** { *; }
-keep class com.github.luben.** { *; }
-keep class com.google.protobuf.** { *; }
-keep class com.jcraft.** { *; }
-keep class com.ning.** { *; }
-keep class net.jpountz.** { *; }
-keep class org.apache.log4j.** { *; }
-keep class org.jboss.log4j.** { *; }
-keep class org.slf4j.** { *; }
-keep class sun.security.** { *; }
-dontwarn org.conscrypt.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**
-dontwarn com.aayushatharva.**
-dontwarn com.github.luben.**
-dontwarn com.google.protobuf.**
-dontwarn com.jcraft.**
-dontwarn com.ning.**
-dontwarn io.netty.**
-dontwarn net.jpountz.**
-dontwarn org.apache.log4j.**
-dontwarn org.jboss.log4j.**
-dontwarn org.slf4j.**
-dontwarn sun.security.**
As I said, I don't like this solution, and it would be really good at least, if you would provide consumer-rules.pro
by your library, so that proguard be able to look at those consumer-rules.pro rules and keep all the sources required for your lib.
+1, this libary doesn't work with ProGuard and the rules in the docs don't work.
I'm trying to build an android application with using HiveMQ library. My project configurations are next:
Java - 17 Kotlin 1.9.20 Gradle - 8.4 Android Gradle Pluging - 8.1.4
For proguard configuration I have the following:
I have added the library as it described in the document: https://hivemq.github.io/hivemq-mqtt-client/docs/installation/android/ I put proguard rules as it described there, but the project still doesn't want to compile, and it gives me the message:
And the whole huge list of usages.
After I got this error I modified the proguard-rules.pro file to the following:
But it still gives me an error about missing sources:
The list about missing sources is really big. I have tried to remove shrinkResources configuration, and the project still doesn't compile. I have tried to modify
To:
But nothing helps me, so what is your suggestions?