运行android Agora_Native_SDK_for_Android_v2_9_2_FULL demo报错

build的时候报错
Duplicate class io.agora.live.LiveChannelConfig found in modules agora-rtc-sdk.jar (agora-rtc-sdk.jar) and full-sdk-2.8.2-runtime.jar (io.agora.rtc:full-sdk:2.8.2)
Duplicate class io.agora.live.LiveEngine found in modules agora-rtc-sdk.jar (agora-rtc-sdk.jar) and full-sdk-2.8.2-runtime.jar (io.agora.rtc:full-sdk:2.8.2)
Duplicate class io.agora.live.LiveEngineHandler found in modules agora-rtc-sdk.jar (agora-rtc-sdk.jar) and full-sdk-2.8.2-runtime.jar (io.agora.rtc:full-sdk:2.8.2)
Duplicate class io.agora.live.LivePublisher found in modules agora-rtc-sdk.jar (agora-rtc-sdk.jar) and full-sdk-2.8.2-runtime.jar (io.agora.rtc:full-sdk:2.8.2)
Duplicate class io.agora.live.LivePublisherHandler found in modules agora-rtc-sdk.jar (agora-rtc-sdk.jar) and full-sdk-2.8.2-runtime.jar (io.agora.rtc:full-sdk:2.8.2)
Duplicate class io.agora.live.LiveStats found in modules agora-rtc-sdk.jar (agora-rtc-sdk.jar) and full-sdk-2.8.2-runtime.jar (io.agora.rtc:full-sdk:2.8.2)
Duplicate class io.agora.live.LiveSubscriber found in modules agora-rtc-sdk.jar (agora-rtc-sdk.jar) and full-sdk-2.8.2-runtime.jar (io.agora.rtc:full-sdk:2.8.2)

是不是 2.8.2 的 jar 包没有移除 ,还在项目里?从报错来看工程里有重复 jar 包。
可以试下直接往 Android Studio 导入 Sample 文件夹,然后根据文件夹里的 Readme 文档添加 SDK,编译运行
https://download.agora.io/sdk/release/Agora_Native_SDK_for_Android_v2_9_2_FULL.zip?_ga=2.261707214.2117450149.1577671902-1276532045.1570589025

implementation ‘io.agora.rtc:full-sdk:2.8.2’
build.gradle里注释掉这句就可以了,
现在在手机上运行,设置完频道id,开始直播,选择我是主播,是黑屏,点击切换摄像头,也是黑屏,这是正常的吗?
手机摄像头没有问题,对应到权限都已经打开。

不正常,有可能是加入频道失败了。你看看控制台的水晶球工具,有没有对应的通话记录?如果没有通话记录则说明加入频道失败了,可以提供 SDK log 给我们来排查一下。

后台没有记录,demo的log如下
12-31 16:45:17.484 26110-26110/io.agora.openlive I/art: Late-enabling -Xcheck:jni
12-31 16:45:17.563 26110-26123/io.agora.openlive E/HAL: load: id=gralloc != hmi->id=gralloc
12-31 16:45:17.692 26110-26110/io.agora.openlive W/Settings: Setting android_id has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
12-31 16:45:17.806 26110-26110/io.agora.openlive I/HwCust: Constructor found for class android.app.HwCustHwWallpaperManagerImpl
12-31 16:45:17.822 26110-26110/io.agora.openlive W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
12-31 16:45:17.864 26110-26110/io.agora.openlive I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
12-31 16:45:17.864 26110-26110/io.agora.openlive I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
12-31 16:45:18.074 26110-26134/io.agora.openlive E/HAL: load: id=gralloc != hmi->id=gralloc
12-31 16:45:18.075 26110-26134/io.agora.openlive I/OpenGLRenderer: Initialized EGL, version 1.4
12-31 16:45:20.420 26110-26116/io.agora.openlive I/art: Debugger is no longer active
12-31 16:45:36.002 26110-26116/io.agora.openlive I/art: Debugger is no longer active

安卓端日志文件默认路径为: /sdcard/{App 的包名}/agorasdk.log。

一般加入频道失败,比较大的可能是鉴权失败导致的,可以检查一下项目是否有启用 app 证书,如果有启用,则必须使用动态密钥鉴权方式,即 join 时需要传入 Token。详情请参考校验用户权限文档:
https://docs.agora.io/cn/Agora%20Platform/token?platform=All%20Platforms

好的,已解决,token的问题

1赞