jitsi / jitsi-meet-sdk-samples

Jitsi Meet mobile SDK examples (Android, iOS and React Native)
Apache License 2.0
270 stars 235 forks source link

Jitsi Android SDK crashes (version 6.1.0) after joining call #157

Closed NilabhB closed 1 year ago

NilabhB commented 1 year ago

I am trying to integrate Jitsi Android SDK for video Conferences on my app but it crashes as soon as I join/create a meeting. I am using Android Version -

Android Studio Dolphin | 2021.3.1 Patch 1
Build #AI-213.7172.25.2113.9123335, built on September 30, 2022
Runtime version: 11.0.13+0-b1751.21-8125866 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0

Here's the java code below for my DashboardActivity.

package com.skymeet.videoConference;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

import org.jitsi.meet.sdk.JitsiMeet;
import org.jitsi.meet.sdk.JitsiMeetActivity;
import org.jitsi.meet.sdk.JitsiMeetConferenceOptions;

import java.net.MalformedURLException;
import java.net.URL;

public class DashboardActivity extends AppCompatActivity {

    EditText codeBox;
    Button joinBtn, shareBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dashboard);

        codeBox = findViewById(R.id.codeBox);
        joinBtn = findViewById(R.id.joinBtn);
        shareBtn = findViewById(R.id.shareBtn); // not implemented yet

        URL serverURL = null;
        try {
            serverURL = new URL("https://meet.jit.si");
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }

        JitsiMeetConferenceOptions defaultOptions
                = new JitsiMeetConferenceOptions.Builder()
                .setServerURL(serverURL)
                .setFeatureFlag("welcomepage.enabled", false)
                .build();

        JitsiMeet.setDefaultConferenceOptions(defaultOptions);

        joinBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                JitsiMeetConferenceOptions options
                        = new JitsiMeetConferenceOptions.Builder()
                        .setRoom(codeBox.getText().toString()).setFeatureFlag("welcomepage.enabled", false)
                        .build();
                JitsiMeetActivity.launch(DashboardActivity.this, options);
            }
        });
    }
}

I have implemented this code with help from https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-android-sdk/

On the Jitsi Android docs they have mentioned this way but this does not imports Jitsi Android SDK to our project.

The repository typically goes into the build.gradle file in the root of your project: build.gradle

allprojects {
    repositories {
        maven {
            url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
        }
        google()
        mavenCentral()
        maven { url 'https://www.jitpack.io' }
    }
}

Dependency definitions belong in the individual module build.gradle files:

dependencies {
    // (other dependencies)
    implementation ('org.jitsi.react:jitsi-meet-sdk:+') { transitive = true }
}

Instead, we used to get a warning like this below while syncing the Gradle files. Failed to resolve: org.jitsi.react:jitsi-meet-sdk:6.1.0 ~~

This can be fixed by placing the repository on settings.gradle as below

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {
            url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
        }
        maven {
            url "https://maven.google.com"
        }
    }
}

After everything is successfully built & installed on devices, my app crashes as soon as I create or join the meeting. Not able to figure out what is causing my application to crash.

After crashing the error comes this way on my mobile phone.

java.lang.RuntimeException: Unable to start service org.jitsi.meet.sdk

Jits MeetOngoingConferenceService@dc6a12a with Intent(cmp=com.skymeet.videoConference/org.jits i.meet.sdk.JitsiMeetOngoingConferenceService (has extras)}: java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(chann el-JitsiOngoingConferenceChannel shortcut=null contentView=null vibrate-null sound=null defaults=0x0 flags=0xa color=0x00000000 category=call actions=2 vis=PUBLIC)

at

android.app.ActivityThread.handleServiceArgs(Activit yThread.java:4802)

at

android.app.ActivityThread.access$2100(ActivityThr

ead.java:276)

at

android.app.ActivityThread$H.handleMessage(Activi

tyThread.java:2156)

at android.os.Handler.dispatchMessage(Handler.java:1 06)

at android.os.Looper.loopOnce (Looper.java:210) at android.os.Looper.loop(Looper.java:299)

at android.app.ActivityThread.main(ActivityThread.java: 8213)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.RuntimeInit$MethodAndArg sCaller.run(RuntimeInit.java:556)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.ja

va:1045) Caused by: java.lang.IllegalArgumentException:

Invalid notification (no valid small icon): Notification(channel-JitsiOngoingConfere

nceChannel shortcut-null contentView=null vibrate-null sound-null defaults=0x0 flags=0xa

color=0x00000000 category=call actions=2

vis PUBLIC)

at

android.app.NotificationManager.fixNotification(Noti ficationManager.java:699) at

android.app.NotificationManager.notifyAsUser(Notifi cationManager.java:678) at

android.app.NotificationManager.notify(Notification Manager.java:627)

at

android.app.NotificationManager.notify(Notification Manager.java:603) at

org.jitsi.meet.sdk.JitsiMeetOngoingConferenceServi ce.onStartCommand(JitsiMeetOngoingConferenceS ervice.java:135)

at

android.app.ActivityThread.handleServiceArgs(Activit yThread.java:4784)

... 9 more

Check video for further error references - https://drive.google.com/file/d/1tXZOtMYQ_Oi1w4UtJ5olyupR13E2HrpV/view?usp=sharing

I tried with older versions as well(like 5.1.0), here we use to get a warning while syncing gradle as shown - Failed to resolve: com.github.MatrixFrog:android-scalablevideoview:v1.0.4-jitpack

And after that while trying to install the app, it gives an error with the build output as - Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

Can someone please help me with this? I will be grateful enough. Thank you!

saghul commented 1 year ago

Invalid notification (no valid small icon):

Missing notification icon. Please supply one.