我正在尝试在我的应用程序上集成用于视频会议的Jitsi Android SDK,但当我加入/创建会议时它就会崩溃。我使用的是 Android 版本 -
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
下面是我的 DashboardActivity 的 java 代码。
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);
}
});
}
}
我在https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-android-sdk/
的帮助下实现了此代码在 Jitsi Android 文档中,他们提到了这种方式 但这不会将 Jitsi Android SDK 导入到我们的项目中。
存储库通常位于项目根目录中的
build.gradle
文件中:
构建.gradle
allprojects {
repositories {
maven {
url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
}
google()
mavenCentral()
maven { url 'https://www.jitpack.io' }
}
}
依赖关系定义属于各个模块
build.gradle
文件:
dependencies {
// (other dependencies)
implementation ('org.jitsi.react:jitsi-meet-sdk:+') { transitive = true }
}
相反,我们在同步 Gradle 文件时经常收到如下警告。
Failed to resolve: org.jitsi.react:jitsi-meet-sdk:6.1.0
~~可以通过将存储库放置在
settings.gradle
上来修复此问题,如下所示
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"
}
}
}
在设备上成功构建和安装所有内容后,我的应用程序在我创建或加入会议时立即崩溃。无法弄清楚是什么导致我的应用程序崩溃。
崩溃后,我的手机上出现这样的错误。 在手机上检查错误屏幕截图
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
查看视频以获取更多错误参考 - https://drive.google.com/file/d/1tXZOtMYQ_Oi1w4UtJ5olyupR13E2HrpV/view?usp=sharing
有人可以帮我吗?我会很感激的。 谢谢!
我自己找到了解决方案。
右键单击android项目中的res文件夹并选择图像资源 来自新部分。
使用以下配置创建图标
名称:ic_notification
图标类型:通知图标
尝试此 SDK 实现并参考链接
dependencies {
// Jitsi Meet
implementation ('org.jitsi.react:jitsi-meet-sdk:5.1.0') { transitive = true }
}
我有同样的问题,我尝试使用旧版本 sdk:5.1.0 并启用 Jetfier 。它解决了我的问题。
转到Gradle.properties添加此
存储库{
maven {
url "https://github.com/jitsi/jitsi-maven repository/raw/master/releases"
}
google()
mavenCentral()
maven { url 'https://www.jitpack.io' }
}
将其添加到 Build.gradle
依赖项{
implementation ('org.jitsi.react:jitsi-meet-sdk:5.1.0') { transitive = true }
}
android.enableJetifier=true