JitsiMeetViewListener don't work only in production release


#1

Dear all,
I’m trying to use binaries for the android sdk (1.21.0) in my android project, and a custom JitsiActivity class.
When the application run in debug mode all working fine, otherwise, when is in release mode all JitsiMeetViewListener events doesn’t triggered.
Can you help me?
Thanks in advance!

Alberto


#2

Did you add any pro-guard rules? It’s posible they are dropped if you don’t tell pro-guard to keep the classes.


#3

This is the proguard-rules.pro content:

# React Native

# Keep our interfaces so they can be used by other ProGuard rules.
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip

# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keep @com.facebook.common.internal.DoNotStrip class *
-keepclassmembers class {
@com.facebook.proguard.annotations.DoNotStrip
;
@com.facebook.common.internal.DoNotStrip *;
}

-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class {
void set
(***);
** get();
}

-keep class extends com.facebook.react.bridge.JavaScriptModule { ; }
-keep class extends com.facebook.react.bridge.NativeModule { ; }
-keepclassmembers,includedescriptorclasses class { native <methods>; }
-keepclassmembers class
{ @com.facebook.react.uimanager.UIProp <fields>; }
-keepclassmembers class { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
-keepclassmembers class
{ @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }

-dontwarn com.facebook.react.**

# TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
-dontwarn android.text.StaticLayout

# okhttp

-keepattributes Signature
-keepattributes Annotation
-keep class okhttp3. { *; }
-keep interface okhttp3.
{ *; }
-dontwarn okhttp3.**

# okio

-keep class sun.misc.Unsafe { ; }
-dontwarn java.nio.file.

-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**

# FastImage + Glide

-keep public class com.dylanvann.fastimage. {;}
-keep public class com.dylanvann.fastimage. {;}
# Glide
-keep public class
implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$
{
** $VALUES;
public *;
}

# We added the following when we switched minifyEnabled on. Probably because we
# ran the app and hit problems…

-keep class com.facebook.react.bridge.CatalystInstanceImpl { ; }
-keep class com.facebook.react.bridge.ExecutorToken {
; }
-keep class com.facebook.react.bridge.JavaScriptExecutor { ; }
-keep class com.facebook.react.bridge.ModuleRegistryHolder {
; }
-keep class com.facebook.react.bridge.ReadableType { ; }
-keep class com.facebook.react.bridge.queue.NativeRunnable {
; }
-keep class com.facebook.react.devsupport. { *; }
-keep class org.webrtc.
{ *; }

-dontwarn com.facebook.react.devsupport.**
-dontwarn com.google.appengine.**
-dontwarn com.squareup.okhttp.**
-dontwarn javax.servlet.**

# ^^^ We added the above when we switched minifyEnabled on.

# Parceler library

-keep interface org.parceler.Parcel
-keep @org.parceler.Parcel class { ; }
-keep class **$$Parcelable { *; }

This proguard-rules-release.pro:

-include proguard-rules.pro

# Parceler
-keep class implements android.os.Parcelable {
public static final android.os.Parcelable$Creator
;
}
-keep interface org.parceler.Parcel
-keep @org.parceler.Parcel class { ; }
-keep class **$$Parcelable { *; }
-keep class org.parceler.Parceler$$Parcels

# Crashlytics
-keepattributes Annotation
-keepattributes SourceFile,LineNumberTable
-keep public class extends java.lang.Exception
-keep class com.crashlytics.** {
; }
-keep class com.google.android.gms.measurement.AppMeasurement { ; }
-keep class com.google.android.gms.measurement.AppMeasurement$OnEventListener {
; }
-dontwarn com.crashlytics.**

proguard-rules-debug.pro:

-include proguard-rules.pro

# Disabling obfuscation is useful if you collect stack traces from production crashes
# (unless you are using a system that supports de-obfuscate the stack traces).
-dontobfuscate

The build code fragments about proguard:

debug {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules-debug.pro’

release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules-release.pro’

Thanks for feedback!
Alberto


#4

You need to add a rule to keep everything in the org.jitsi.meet package.


#5

I see that if in release mode I use:

minifyEnabled true

instead of:

minifyEnabled false

the app doesn’t work.


#6

Yes! keeping org.jitsi.meet package in proguard rules works.
Thanks, have a nice day!

Alberto


#7

Glad that worked for you!