Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Attempt to invoke virtual method 'java.lang.Object java.util.HashMap.put(java.lang.Object, java.lang.Object)' on a null object reference #45

Closed
yukitaka13-1110 opened this issue Dec 5, 2019 · 23 comments

Comments

@yukitaka13-1110
Copy link

Just a bug report.

I build sample code of this repository.
When start AgoraRTC video chat, the following error occurred.

I/AGORA_SDK(32650): Surface changed to width 1080 height 1808
E/RtcEngine(32470): onEvent: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.HashMap.put(java.lang.Object, java.lang.Object)' on a null object reference

What should I do ?

@yukitaka13-1110 yukitaka13-1110 changed the title [bug] E/RtcEngine(32470): onEvent: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.HashMap.put(java.lang.Object, java.lang.Object)' on a null object reference [bug] Attempt to invoke virtual method 'java.lang.Object java.util.HashMap.put(java.lang.Object, java.lang.Object)' on a null object reference Dec 5, 2019
@yukitaka13-1110
Copy link
Author

It's Agora SDK logs.

I/CameraManagerGlobal(  475): Connecting to camera service
D/HostConnection(  475): HostConnection::get() New Host Connection established 0xb9f7aa50, tid 572
D/HostConnection(  475): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0 
D/eglCodecCommon(  475): setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation(  475): eglCreateContext: 0xd225e000: maj 3 min 0 rcv 3
I/AGORA_SDK(  475): INFO    ( 0:36:57:955 |   29)    565; Agora Engine video codec set to custom mode role mode 0
I/AGORA_SDK(  475): INFO    ( 0:36:57:956 |    1)    565; Agora Engine video codec index 1
I/AGORA_SDK(  475): INFO    ( 0:36:57:956 |    0)    565; Agora Engine video stream type = 0
D/AGORA_SDK(  475): MEMORY  ( 0:36:57:956 |    0)    565; SSRCDatabase created
D/AGORA_SDK(  475): MEMORY  ( 0:36:57:957 |    1)    565; RTPSender created
D/AGORA_SDK(  475): MEMORY  ( 0:36:57:958 |    1)    565; RTCPSender created
D/AGORA_SDK(  475): MEMORY  ( 0:36:57:958 |    0)    565; RTCPReceiver created
D/AGORA_SDK(  475): MEMORY  ( 0:36:57:958 |    0)    565; ModuleRtpRtcpImpl created
D/AGORA_SDK(  475): MODCALL ( 0:36:57:958 |    0)    565; SetMaxTransferUnit(1300)
D/AGORA_SDK(  475): MODCALL ( 0:36:57:958 |    0)    565; SetREMBStatus(disable)
D/AGORA_SDK(  475): MODCALL ( 0:36:57:958 |    0)    565; SetStartTimestamp(0)
D/AGORA_SDK(  475): MODCALL ( 0:36:57:958 |    0)    565; SetGenericFECStatus(enable, 116)
D/AGORA_SDK(  475): MODCALL ( 0:36:57:958 |    0)    565; RegisterSendPayload(pl_name:H264 pl_type:107)
D/AGORA_SDK(  475): MODCALL ( 0:36:57:958 |    0)    565; RegisterSendPayload(pl_name:VP8 pl_type:100)
D/AGORA_SDK(  475): MODCALL ( 0:36:57:959 |    1)    565; SetRTCPStatus(1)
D/AGORA_SDK(  475): MODCALL ( 0:36:57:959 |    0)    565; MaxDataPayloadLength()
D/EGL_emulation(  475): eglMakeCurrent: 0xd571a0c0: ver 3 0 (tinfo 0xd570f530)
I/AGORA_SDK(  475): INFO    ( 0:36:57:970 |   11)    574; Thread with name:VideoEncodeThread started 
I/AGORA_SDK(  475): INFO    ( 0:36:57:970 |    0)    565; last unique frame idx: -1 - -1
I/AGORA_SDK(  475): INFO    ( 0:36:57:971 |    1)    565; EncoderWrapper::Create hardware_ = 0, hardware_low_ = 0
I/AGORA_SDK(  475): INFO    ( 0:36:57:971 |    0)    565; hwenc=0,hwenc_low=0,enlarge_big = 0,enlarge_small=0
I/AGORA_SDK(  475): INFO    ( 0:36:57:971 |    0)    565; low bit rate limit 1610612736
I/AGORA_SDK(  475): INFO    ( 0:36:57:971 |    0)    565; dont need to increase unique frame idx
I/AGORA_SDK(  475): INFO    ( 0:36:57:971 |    0)    565; the init unique frame idx: -1 - -1
D/AGORA_SDK(  475): MODCALL ( 0:36:57:971 |    0)    565; RegisterSendPayload(pl_name:H264 pl_type:107)
D/AGORA_SDK(  475): MODCALL ( 0:36:57:971 |    0)    565; SetSendingStatus(stopped)
D/AGORA_SDK(  475): MODCALL ( 0:36:57:971 |    0)    565; SetTargetSendBitrate: 1 streams
D/AGORA_SDK(  475): MODCALL ( 0:36:57:971 |    0)    565; Sending()
D/AGORA_SDK(  475): MODCALL ( 0:36:57:971 |    0)    565; SetSendingStatus(sending)
D/AGORA_SDK(  475): MODCALL ( 0:36:57:971 |    0)    565; CurrentSendFrequencyHz()
D/AGORA_SDK(  475): MODCALL ( 0:36:57:971 |    0)    565; PacketCountSent()
D/AGORA_SDK(  475): MODCALL ( 0:36:57:971 |    0)    565; ByteCountSent()
I/AGORA_SDK(  475): INFO    ( 0:36:57:981 |   10)    575; Thread with name:VideoProcessThread started 
I/AGORA_SDK(  475): INFO    ( 0:36:57:982 |    1)    565; setCodec: index=1 width=640 height=360 framerate=15
D/AGORA_SDK(  475): APICALL ( 0:36:57:983 |  138)    565; SendCodec type
D/AGORA_SDK(  475): APICALL ( 0:36:57:983 |    0)    565; SendCodec
I/AGORA_SDK(  475): INFO    ( 0:36:57:983 |    1)    565; setCodec: Intra Request = 0
D/AGORA_SDK(  475): MODCALL ( 0:36:57:983 |    0)    565; MaxDataPayloadLength()
D/EGL_emulation(  475): eglMakeCurrent: 0xd225e000: ver 3 0 (tinfo 0xbe49f230)
I/AGORA_SDK(  475): INFO    ( 0:36:57:997 |   14)    576; Thread with name:VideoEncodeThread started 
D/AGORA_SDK(  475): APICALL ( 0:36:57:997 |   14)    565; SendCodec
D/AGORA_SDK(  475): MODCALL ( 0:36:57:997 |    0)    565; RegisterSendPayload(pl_name:H264 pl_type:107)
D/AGORA_SDK(  475): MODCALL ( 0:36:57:997 |    0)    565; SetTargetSendBitrate: 1 streams
D/AGORA_SDK(  475): MODCALL ( 0:36:57:997 |    0)    565; Sending()
D/AGORA_SDK(  475): APICALL ( 0:36:57:998 |    1)    565; setCodec : 1 :H264
I/AGORA_SDK(  475): INFO    ( 0:36:57:998 |    1)    565; EnableLowBitRateStream: dual streams enabled 1 share 0 details 0
I/AGORA_SDK(  475): INFO    ( 0:36:57:998 |    0)    565; h264WebInteropEnable: enable 1
I/AGORA_SDK(  475): INFO    ( 0:36:57:998 |    0)    565; setCaptureDevice: index=1
I/AGORA_SDK(  475): INFO    ( 0:36:58:  4 |    0)    565; setMaxVideoBitrate: max bitrate=0
I/AGORA_SDK(  475): INFO    ( 0:36:58:  4 |    0)    565; set lowBitRateStreamParamete w/h/fps/br (320/180/15/140)
I/AGORA_SDK(  475): INFO    ( 0:36:58:  5 |    1)    565; setCodecResolutionLow: 320 * 180
I/AGORA_SDK(  475): INFO    ( 0:36:58:  5 |    0)    565; setCodecFramerateLow: 15
I/AGORA_SDK(  475): INFO    ( 0:36:58:  5 |    0)    565; setMaxVideoBitrateLow: 140
I/AGORA_SDK(  475): INFO    ( 0:36:58:  6 |    1)    565; setCodec: index=1 width=640 height=360 framerate=15
D/AGORA_SDK(  475): APICALL ( 0:36:58:  6 |    0)    565; SendCodec type
D/AGORA_SDK(  475): APICALL ( 0:36:58:  7 |    1)    565; SendCodec
I/AGORA_SDK(  475): INFO    ( 0:36:58:  7 |    1)    565; setCodec: Intra Request = 0
D/AGORA_SDK(  475): MODCALL ( 0:36:58:  7 |    0)    565; MaxDataPayloadLength()
I/AGORA_SDK(  475): Surface changed to width 1080 height 1808
I/AGORA_SDK(  475): INFO    ( 0:36:58: 23 |   16)    565; last unique frame idx: -1 - -1
I/AGORA_SDK(  475): INFO    ( 0:36:58: 23 |    0)    565; EncoderWrapper::Create hardware_ = 0, hardware_low_ = 0
I/AGORA_SDK(  475): INFO    ( 0:36:58: 23 |    0)    565; hwenc=0,hwenc_low=0,enlarge_big = 0,enlarge_small=0
I/AGORA_SDK(  475): INFO    ( 0:36:58: 23 |    0)    565; low bit rate limit 0
I/AGORA_SDK(  475): INFO    ( 0:36:58: 23 |    0)    565; dont need to increase unique frame idx
I/AGORA_SDK(  475): INFO    ( 0:36:58: 23 |    0)    565; the init unique frame idx: -1 - -1
D/AGORA_SDK(  475): APICALL ( 0:36:58: 23 |   16)    565; SendCodec
D/AGORA_SDK(  475): MODCALL ( 0:36:58: 23 |    0)    565; RegisterSendPayload(pl_name:H264 pl_type:107)
D/AGORA_SDK(  475): MODCALL ( 0:36:58: 23 |    0)    565; SetTargetSendBitrate: 1 streams
I/AGORA_SDK(  475): INFO    ( 0:36:58: 23 |    0)    577; Thread with name:VideoEncodeThread started 
D/AGORA_SDK(  475): MODCALL ( 0:36:58: 23 |    0)    565; Sending()
D/AGORA_SDK(  475): APICALL ( 0:36:58: 23 |    0)    565; setCodec : 1 :H264
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    1)    565; Setting video fec method 1, real using 1
D/AGORA_SDK(  475): MODCALL ( 0:36:58: 24 |    0)    565; SetGenericFECStatus(enable, 116)
D/AGORA_SDK(  475): MODCALL ( 0:36:58: 24 |    0)    565; GenericFECStatus()
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; SetBandwidthAgressiveLevel to 2.
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; dynamic sending rate control set to 2.
D/AGORA_SDK(  475): MODCALL ( 0:36:58: 24 |    0)    565; SetMaxTransferUnit(1300)
D/AGORA_SDK(  475): MODCALL ( 0:36:58: 24 |    0)    565; GenericFECStatus()
D/AGORA_SDK(  475): APICALL ( 0:36:58: 24 |    1)    565; init
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; videoEngine created and initialize here
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; CreateVideoSendTrack
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; [MIO] updateCapturer: (0x0), type:(1)
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; CreateAgoraDefaultCapture: type=0
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; VideoSendTrackImpl::UpdateCapturer capturer=0xbab51ea0
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; CreateVideoCapturer: interface=0xbab51ea0
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; [MIO] updateLocalRender: (0x0), type:(1)
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; CreateAgoraDefaultRender
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; VideoSendTrackImpl::UpdateRenderer, renderer=0xbadb5ca0
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; CreateVideoRenderer: interface=0xbadb5ca0
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; [MIO] video send track prepared !!
I/AGORA_SDK(  475): INFO    ( 0:36:58: 24 |    0)    565; [che] applyVideoProfile: 640x360 15 fps  -1 minFps 400 kbps, min -1 kbps orientationMode 0 degradationPrefer 0
I/AGORA_SDK(  475): INFO    ( 0:36:58: 84 |   60)    565; validateVideoParameters: validate video parameters resolution 640x360, fps 15, rate 400000
I/AGORA_SDK(  475): INFO    ( 0:36:58: 84 |    0)    565; setMaxVideoBitrate: max bitrate=400000
I/AGORA_SDK(  475): INFO    ( 0:36:58: 84 |    0)    565; setCodecRates: set frame rate to 15
D/AGORA_SDK(  475): APICALL ( 0:36:58: 84 |   60)    565; SendCodec
I/AGORA_SDK(  475): INFO    ( 0:36:58: 84 |    0)    565; setCodec: index=1 width=640 height=360 framerate=15
D/AGORA_SDK(  475): APICALL ( 0:36:58: 84 |    0)    565; SendCodec type
D/AGORA_SDK(  475): APICALL ( 0:36:58: 84 |    0)    565; SendCodec
I/AGORA_SDK(  475): INFO    ( 0:36:58: 84 |    0)    565; setCodec: Intra Request = 0
D/AGORA_SDK(  475): MODCALL ( 0:36:58: 84 |    0)    565; MaxDataPayloadLength()
I/AGORA_SDK(  475): INFO    ( 0:36:58: 98 |   14)    578; Thread with name:VideoEncodeThread started 
I/AGORA_SDK(  475): INFO    ( 0:36:58: 98 |    0)    565; last unique frame idx: -1 - -1
I/AGORA_SDK(  475): INFO    ( 0:36:58: 98 |    0)    565; EncoderWrapper::Create hardware_ = 0, hardware_low_ = 0
I/AGORA_SDK(  475): INFO    ( 0:36:58: 98 |    0)    565; hwenc=0,hwenc_low=0,enlarge_big = 0,enlarge_small=0
I/AGORA_SDK(  475): INFO    ( 0:36:58: 98 |    0)    565; low bit rate limit 0
I/AGORA_SDK(  475): INFO    ( 0:36:58: 98 |    0)    565; dont need to increase unique frame idx
I/AGORA_SDK(  475): INFO    ( 0:36:58: 98 |    0)    565; the init unique frame idx: -1 - -1
D/AGORA_SDK(  475): APICALL ( 0:36:58: 98 |   14)    565; SendCodec
I/AGORA_SDK(  475): INFO    ( 0:36:58: 98 |    0)    565; SetTargetWidthHeight width:640, height:360
D/AGORA_SDK(  475): MODCALL ( 0:36:58: 98 |    0)    565; RegisterSendPayload(pl_name:H264 pl_type:107)
D/AGORA_SDK(  475): MODCALL ( 0:36:58: 98 |    0)    565; SetTargetSendBitrate: 1 streams
D/AGORA_SDK(  475): MODCALL ( 0:36:58: 98 |    0)    565; Sending()
D/AGORA_SDK(  475): APICALL ( 0:36:58: 98 |    0)    565; setCodec : 1 :H264
I/AGORA_SDK(  475): INFO    ( 0:36:58: 98 |    0)    565; setCodecResolution: set to 640 x 360
I/AGORA_SDK(  475): INFO    ( 0:36:58: 98 |    0)    565; Set broadcast min br to -1.
D/AGORA_SDK(  475): DEBUG   ( 0:36:58: 98 |    0)    565; async_queue created: 0xbac23e80
I/AGORA_SDK(  475): INFO    ( 0:36:58: 98 |    0)    565; [che] chat engine initialized
I/AGORA_SDK(  475): INFO    ( 0:36:58: 99 |    1)    565; [time] process EngineInitialize takes 285
E/RtcEngine(  475): onEvent: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.HashMap.put(java.lang.Object, java.lang.Object)' on a null object reference
I/AGORA_SDK(  475): INFO    ( 0:36:58:110 |   11)    565; [tactics] config json version:20150101-0000 duallinkd:true poor:u
I/AGORA_SDK(  475): INFO    ( 0:36:58:110 |    0)    565; [tactics] parse config for beckon error for tactics size:18
D/AGORA_SDK(  475): DEBUG   ( 0:36:58:110 |    0)    565; [tactics] version:2.9.1 maxBitrate:600 360X640 15 fps
I/AGORA_SDK(  475): INFO    ( 0:36:58:111 |    1)    565; [vocs] vocs initialized

@plutoless
Copy link
Contributor

i think that error can be simply ignored for now. you can use our sdk w/o problem with that error.

@hussenIbrahim
Copy link

i faced the same error
it was because missed permissions

@LichKing-2234
Copy link
Contributor

I will close this issue because it is not active. if there are still problems, you can reopen this issue.

@VocsyDikshit
Copy link

I have the same Issue using Agora sdk in flutter
error : java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.HashMap.put(java.lang.Object, java.lang.Object)' on a null object reference

is there any solution ??? for it?>>

@LichKing-2234
Copy link
Contributor

@VocsyDikshit Which version of our SDK you used? and which method throws this exception?

@VocsyDikshit
Copy link

onEvent: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.HashMap.put(java.lang.Object, java.lang.Object)' on a null object reference

i'am using flutter sdk 2.0.6

@VocsyDikshit
Copy link

await _initAgoraRtcEngine();
_addAgoraEventHandlers();
await AgoraRtcEngine.enableWebSdkInteroperability(true);
VideoEncoderConfiguration configuration = VideoEncoderConfiguration();
configuration.dimensions = Size(1920, 1080);
await AgoraRtcEngine.setVideoEncoderConfiguration(configuration);
await AgoraRtcEngine.joinChannel(
"token from agora",
widget.channelName,
null,
0);

this method in initstate()

Future _initAgoraRtcEngine() async {
await AgoraRtcEngine.create(APP_ID);
widget.callType == "VideoCall"
? await AgoraRtcEngine.enableVideo()
: await AgoraRtcEngine.enableAudio();
await AgoraRtcEngine.setChannelProfile(ChannelProfile.LiveBroadcasting);
await AgoraRtcEngine.setClientRole(widget.role);
}

/// Add agora event handlers
void _addAgoraEventHandlers() {
AgoraRtcEngine.onError = (dynamic code) {
print('failed ++ ');
setState(() {
final info = 'onError: $code';
_infoStrings.add(info);
});
};

AgoraRtcEngine.onJoinChannelSuccess = (
  String channel,
  int uid,
  int elapsed,
) {
  print('onJoinChannelSuccess');
  setState(() {
    final info = 'onJoinChannel: $channel, uid: $uid';
    _infoStrings.add(info);
  });
};

AgoraRtcEngine.onLeaveChannel = () {
  print('onLeaveChannel');
  setState(() {
    _infoStrings.add('onLeaveChannel');
    _users.clear();
  });
};

AgoraRtcEngine.onUserJoined = (int uid, int elapsed) {
  print('onuserJoined');
  setState(() {
    final info = 'userJoined: $uid';
    _infoStrings.add(info);
    _users.add(uid);
  });
};

AgoraRtcEngine.onUserOffline = (int uid, int reason) {
  print('onUserOffline');
  setState(() {
    final info = 'userOffline: $uid';
    _infoStrings.add(info);
    _users.remove(uid);
  });
  Navigator.pop(context);
};

AgoraRtcEngine.onFirstRemoteVideoFrame = (
  int uid,
  int width,
  int height,
  int elapsed,
) {
  print('onFirstRemoteVideoFrame');
  setState(() {
    final info = 'firstRemoteVideo: $uid ${width}x $height';
    _infoStrings.add(info);
  });
};

}

@VocsyDikshit
Copy link

@VocsyDikshit Which version of our SDK you used? and which method throws this exception?

Reply Please

@VocsyDikshit
Copy link

The real Problem is when I video call to other mobile Device it is not connecting to the Other Device as Video but It's showing my own camera! as a Video call..

@LichKing-2234
Copy link
Contributor

@VocsyDikshit The 2.0.6 version is out-of-date, pls follow our example to migrate to the latest version.

@VocsyDikshit
Copy link

I really Don't think migrating to a newer Version will Resolve my error as I have Already Migrated and tried once! It Shows the Same I Personally think I might have Agora sdk installation error or my Code error!

at Last my videos call app Video Switching from one Device to other Device isn't working !

@VocsyDikshit The 2.0.6 version is out-of-date, pls follow our example to migrate to the latest version.

@VocsyDikshit
Copy link

Is there Any way I can resolve my Error and have Working Functionality?

@LichKing-2234
Copy link
Contributor

@VocsyDikshit
Copy link

What should I place in uid and String Uid in example code

??

@VocsyDikshit
Copy link

@VocsyDikshit you can try our example first.
https://github.com/AgoraIO/Agora-Flutter-SDK/tree/master/example

What should I place in uid and String Uid in example code??

@LichKing-2234
Copy link
Contributor

you can special it by yourself.

@VocsyDikshit
Copy link

Yes I have Tried Your Example and it Works fluently! But The Code I have Done and Yours Are Different
ex:
your- await _engine.joinChannel(config.token, config.channelId, null, 0, null);
mine; await AgoraRtcEngine.joinChannel(null, widget.channelName, null, 0);

what might be the Difference ?

@VocsyDikshit
Copy link

you can special it by yourself.

???

@LichKing-2234
Copy link
Contributor

@VocsyDikshit yes, the API has been changed on the new version.

@LichKing-2234
Copy link
Contributor

@VocsyDikshit you can replace the uid and stringUid with any value.

@VocsyDikshit
Copy link

As my Video Chat Application is online my Token is generating from Server, I am Passing null value from join Channel function
What if my Token Generation fails to generate and showing this Error? By this Reason the Videos might be not Switching to other Device? What are your thinking about it?

@LichKing-2234
Copy link
Contributor

if you enable certificate, you must use token to join channel. you can get more info by searching on our official website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants