我有一个应用程序,现在我想与您的agora sdk集成,以便可以广播它。我已按照您的快速入门指南中的说明进行了所有操作,但我在执行错误操作时着陆。 到目前为止,我最好的猜测是RtcEngine的create方法中存在错误。请帮助
这是logcat的一部分
2019-04-09 04:23:04.794 2025-2025/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2019-04-09 04:23:04.796 2025-2025/? E/libpersona: scanKnoxPersonas
2019-04-09 04:23:04.796 2025-2025/? E/libpersona: Couldn't open the File - /data/system/users/0/personalist.xml - No such file or directory
2019-04-09 04:23:04.799 2025-2025/? E/libpersona: scanKnoxPersonas
2019-04-09 04:23:04.799 2025-2025/? E/libpersona: Couldn't open the File - /data/system/users/0/personalist.xml - No such file or directory
2019-04-09 04:23:05.106 2039-2039/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2019-04-09 04:23:05.107 2039-2039/? E/libpersona: scanKnoxPersonas
2019-04-09 04:23:05.107 2039-2039/? E/libpersona: Couldn't open the File - /data/system/users/0/personalist.xml - No such file or directory
2019-04-09 04:23:05.505 2039-2057/? E/GOS:SeDex: failed to getSystemService()
2019-04-09 04:23:05.511 2039-2057/? E/GOS:SeDex: failed to getSystemService()
2019-04-09 04:23:05.941 3003-4499/? E/Parcel: Class not found when unmarshalling: ugq
java.lang.ClassNotFoundException: ugq
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at android.os.Parcel.readParcelableCreator(Parcel.java:2913)
at android.os.Parcel.readParcelable(Parcel.java:2867)
at android.os.Parcel.readValue(Parcel.java:2770)
at android.os.Parcel.readArrayMapInternal(Parcel.java:3139)
at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:273)
at android.os.BaseBundle.unparcel(BaseBundle.java:226)
at android.os.BaseBundle.getString(BaseBundle.java:1118)
at android.content.Intent.getStringExtra(Intent.java:7807)
at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:509)
at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:454)
at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1375)
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6295)
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:6144)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:4024)
at android.os.Binder.execTransact(Binder.java:705)
Caused by: java.lang.ClassNotFoundException: ugq
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:1355)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:1415)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at android.os.Parcel.readParcelableCreator(Parcel.java:2913)
at android.os.Parcel.readParcelable(Parcel.java:2867)
at android.os.Parcel.readValue(Parcel.java:2770)
at android.os.Parcel.readArrayMapInternal(Parcel.java:3139)
at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:273)
at android.os.BaseBundle.unparcel(BaseBundle.java:226)
at android.os.BaseBundle.getString(BaseBundle.java:1118)
at android.content.Intent.getStringExtra(Intent.java:7807)
at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:509)
at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:454)
at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1375)
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6295)
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:6144)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:4024)
at android.os.Binder.execTransact(Binder.java:705)
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
2019-04-09 04:23:09.487 458-458/? E/ViewRootImpl: sendUserActionEvent() returned.
这是我正在做的一些代码
public void init(){
initMRtcEventHandler();
initializeAgoraEngine();
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING);
mRtcEngine.enableVideo();
joinChannel();
}
private void initializeAgoraEngine() {
try {
mRtcEngine = RtcEngine.create(getBaseContext(), getString(R.string.agora_app_id), mRtcEventHandler);
} catch (Exception e) {
Log.e(LOG_TAG, Log.getStackTraceString(e));
throw new RuntimeException("NEED TO check rtc sdk init fatal error\n" + Log.getStackTraceString(e));
}
}
private void initMRtcEventHandler(){
mRtcEventHandler=new IRtcEngineEventHandler() {
@Override
public void onFirstRemoteVideoDecoded(int uid, int width, int height, int elapsed) {
setupRemoteVideo(uid);
}
@Override
public void onUserOffline(int uid, int reason) {
super.onUserOffline(uid, reason);
}
@Override
public void onUserJoined(int uid, int elapsed) {
super.onUserJoined(uid, elapsed);
}
@Override
public void onLeaveChannel(RtcStats stats) {
leaveChannel();
}
@Override
public void onVideoStopped() {
super.onVideoStopped();
}
@Override
public void onUserEnableVideo(int uid, boolean enabled) {
setupVideoProfile();
}
};
}
private void joinChannel() {
mRtcEngine.setClientRole(Constants.CLIENT_ROLE_BROADCASTER);
mRtcEngine.joinChannel(null, "demoChannel1", "Extra Optional Data", 0); // If you do not specify the uid, Agora will assign one.
}
private void setupVideoProfile(){
VideoEncoderConfiguration.ORIENTATION_MODE
orientationMode =
VideoEncoderConfiguration.ORIENTATION_MODE.ORIENTATION_MODE_FIXED_PORTRAIT;
VideoEncoderConfiguration.VideoDimensions dimensions = new VideoEncoderConfiguration.VideoDimensions(360, 640);
VideoEncoderConfiguration videoEncoderConfiguration = new VideoEncoderConfiguration(
dimensions, VideoEncoderConfiguration.FRAME_RATE.FRAME_RATE_FPS_24, 150, orientationMode);
mRtcEngine.setVideoEncoderConfiguration(videoEncoderConfiguration);
}
private void setupLocalVideo() {
FrameLayout container = (FrameLayout) findViewById(R.id.local_video_view_container);
SurfaceView surfaceView = RtcEngine.CreateRendererView(getBaseContext());
surfaceView.setZOrderMediaOverlay(true);
container.addView(surfaceView);
mRtcEngine.setupLocalVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_ADAPTIVE, 0));
}
private void setupRemoteVideo(int uid) {
FrameLayout container = (FrameLayout) findViewById(R.id.remote_video_view_container);
if (container.getChildCount() >= 1) {
return;
}
SurfaceView surfaceView = RtcEngine.CreateRendererView(getBaseContext());
container.addView(surfaceView);
mRtcEngine.setupRemoteVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_ADAPTIVE, uid));
surfaceView.setTag(uid);
View tipMsg = findViewById(R.id.quick_tips_when_use_agora_sdk);
tipMsg.setVisibility(View.GONE);
}
private void leaveChannel() {
mRtcEngine.leaveChannel();
}
和onCreate中有一个对init()的调用;