1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Flutter jitsi meet not workin on release apk. App gets stopped when click on...

Discussão em 'Mobile' iniciado por Stack, Outubro 17, 2024 às 20:42.

  1. Stack

    Stack Membro Participativo

    **Here's my code for Jitsi- ** We are using the jitsi_meet_flutter_sdk package for jitsi

    Issue with ProGuard in Flutter Jitsi Meet App

    Problem Statement


    I'm facing issues with JITSI in my Flutter app that integrates the Jitsi Meet SDK. The app is crashing or showing unexpected behavior during runtime, and I suspect it's related to ProGuard.

    Details

    • Flutter Version: [Your Flutter Version]
    • Jitsi Meet SDK Version: [Your Jitsi Meet SDK Version]
    • Error Messages or Logs: [Include any relevant error messages or logs]
    What I've Tried


    I have added ProGuard rules for Jitsi Meet SDK in my proguard-rules.pro file. Additionally, I've set minifyEnabled and useProguard to true in the build.gradle file.

    class JitsiProvider extends ChangeNotifier {
    bool _isMeetingComplete = false;
    bool get isMeetingComplete => _isMeetingComplete;
    bool _hasUserJoined = false;
    bool get hasUserJoined => _hasUserJoined;
    late Timer _meetingTimer;
    void createMeeting({
    required String appointmentID,
    required String roomName,
    required String meetURL,
    required String meetDescription,
    required bool isAudioMuted,
    required bool isVideoMuted,
    String username = '',
    String email = '',
    String userProfile = '',
    bool preJoined = true,
    bool isVideo = true,
    bool isGroup = true,
    }) async {
    print("APP ID : $appointmentID");
    try {
    _hasUserJoined = true;
    notifyListeners();

    // Starting a timer for 15 minutes
    // Initialize the meeting timer with a null check
    _meetingTimer = Timer(
    Duration(
    minutes: 20,
    ), () {
    callAPIappointmentCompleted(appointmentID);
    endMeeting();
    JitsiMeet().hangUp();
    });
    Map<String, dynamic> featureFlag = {};
    featureFlag['welcomepage.enabled'] = false;
    featureFlag['prejoinpage.enabled'] = preJoined;
    featureFlag['add-people.enabled'] = isGroup;

    var options = JitsiMeetConferenceOptions(
    room: roomName,
    serverURL: meetURL,
    configOverrides: {
    "startWithAudioMuted": isAudioMuted,
    "startWithVideoMuted": isVideoMuted,
    "subject": meetDescription,
    },
    userInfo: JitsiMeetUserInfo(
    displayName: username,
    email: email,
    avatar: userProfile,
    ),
    featureFlags: {
    "unsaferoomwarning.enabled": false,
    "add-people.enabled": false, // Set it to false here
    'chat.enabled': true,
    'invite.enabled': false,
    'ios.recording.enabled': false,
    'recording.enabled': false,
    'kick-out.enabled': false,
    },
    );
    var eventListeners = JitsiMeetEventListener(
    conferenceTerminated: (url, error) {
    print("MEET TERMINATED");
    print(url);
    callAPIappointmentCompleted(appointmentID);
    },
    participantLeft: (participantId) {
    print("user has left");
    print(participantId);
    callAPIappointmentCompleted(appointmentID);
    },
    );
    await JitsiMeet().join(options, eventListeners);
    } catch (error) {
    print("error: $error");
    }
    }

    void onMeetingEnd() {
    // Call your function here
    callAPIappointmentCompleted("YOUR_APPOINTMENT_ID");
    // Print the log message
    print("Log out initiated");
    }

    void endMeeting() {
    _isMeetingComplete = true;
    notifyListeners();
    _meetingTimer.cancel();
    onMeetingEnd();
    }




    }

    I tried to add this progaurd-rules.pro file-

    #=== Flutter Wrapper ===#
    -keep class io.flutter.app.** { *; }
    -keep class io.flutter.plugin.** { *; }
    -keep class io.flutter.util.** { *; }
    -keep class io.flutter.view.** { *; }
    -keep class io.flutter.** { *; }
    -keep class io.flutter.plugins.** { *; }

    #=== Jitsi ===#
    # Source: https://github.com/jitsi/jitsi-meet/blob/master/android/app/proguard-rules.pro
    # Check above link for changes if release builds are broken again

    # Copyright (c) Facebook, Inc. and its affiliates.
    #
    # This source code is licensed under the MIT license found in the
    # LICENSE file in the root directory of this source tree.

    # Add project specific ProGuard rules here.
    # By default, the flags in this file are appended to flags specified
    # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
    # You can edit the include path and order by changing the proguardFiles
    # directive in build.gradle.
    #
    # For more details, see
    # http://developer.android.com/guide/developing/tools/proguard.html

    # Add any project specific keep options here:

    # 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.**
    -keep,includedescriptorclasses class com.facebook.react.bridge.** { *; }

    # 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
    -keep class okio.** { *; }
    -dontwarn okio.**

    # WebRTC

    -keep class org.webrtc.** { *; }
    -dontwarn org.chromium.build.BuildHooksAndroid

    # Jisti Meet SDK

    -keep class org.jitsi.meet.** { *; }
    -keep class org.jitsi.meet.sdk.** { *; }
    -keep class org.jitsi.** { *; }
    -keep interface org.jitsi.** { *; }

    # 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.** { *; }

    -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.

    # Rule to avoid build errors related to SVGs.
    -keep public class com.horcrux.svg.** {*;}

    # Hermes
    -keep class com.facebook.hermes.unicode.** { *; }

    Continue reading...

Compartilhe esta Página