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

Cannot initialize Agora RTM Service, error: 1 #177

Open
shiv71 opened this issue Apr 25, 2022 · 7 comments
Open

Cannot initialize Agora RTM Service, error: 1 #177

shiv71 opened this issue Apr 25, 2022 · 7 comments

Comments

@shiv71
Copy link

shiv71 commented Apr 25, 2022

Getting crash in Firebase crashlytics when initializing agora RTM SDK.

cannot initialize Agora RTM Service, error: 1

Fatal Exception: java.lang.RuntimeException: Unable to create application com.buddynation.dronenation.Applications: java.lang.RuntimeException: NEED TO check rtm sdk init fatal error
java.lang.IllegalArgumentException: cannot initialize Agora RTM Service, error: 1
	at io.agora.rtm.internal.RtmClientImpl.initRtmService(SourceFile:17)
	at io.agora.rtm.internal.RtmClientImpl.<init>(SourceFile:28)
	at io.agora.rtm.internal.RtmManager.createRtmInstance(SourceFile:1)
	at io.agora.rtm.RtmClient.createInstance(SourceFile:1)
	at com.buddynation.dronenation.livestream.chat.rtmtutorial.ChatManager.init(SourceFile:2)
	at com.buddynation.dronenation.Applications.onCreate(SourceFile:42)
	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1190)
	at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7184)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7134)
	at android.app.ActivityThread.access$1600(ActivityThread.java:274)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2102)
	at android.os.Handler.dispatchMessage(Handler.java:107)
	at android.os.Looper.loop(Looper.java:237)
	at android.app.ActivityThread.main(ActivityThread.java:8167)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

       at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7189)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7134)
       at android.app.ActivityThread.access$1600(ActivityThread.java:274)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2102)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:8167)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
Caused by java.lang.RuntimeException: NEED TO check rtm sdk init fatal error
java.lang.IllegalArgumentException: cannot initialize Agora RTM Service, error: 1
	at io.agora.rtm.internal.RtmClientImpl.initRtmService(SourceFile:17)
	at io.agora.rtm.internal.RtmClientImpl.<init>(SourceFile:28)
	at io.agora.rtm.internal.RtmManager.createRtmInstance(SourceFile:1)
	at io.agora.rtm.RtmClient.createInstance(SourceFile:1)
	at com.buddynation.dronenation.livestream.chat.rtmtutorial.ChatManager.init(SourceFile:2)
	at com.buddynation.dronenation.Applications.onCreate(SourceFile:42)
	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1190)
	at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7184)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7134)
	at android.app.ActivityThread.access$1600(ActivityThread.java:274)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2102)
	at android.os.Handler.dispatchMessage(Handler.java:107)
	at android.os.Looper.loop(Looper.java:237)
	at android.app.ActivityThread.main(ActivityThread.java:8167)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

       at com.buddynation.dronenation.livestream.chat.rtmtutorial.ChatManager.init(ChatManager.java:105)
       at com.buddynation.dronenation.Applications.onCreate(Applications.java:262)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1190)
       at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7184)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7134)
       at android.app.ActivityThread.access$1600(ActivityThread.java:274)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2102)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:8167)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
@plutoless
Copy link
Contributor

@shiv71 hi, which demo are you running? or it's your own project? if it's your own project, could you pls share the minima reproducible project with us? cheers

@shiv71
Copy link
Author

shiv71 commented May 2, 2022

It's our own project and we have an account on the agora and we are paid users.
Our project is large and according to NDA, we can not share the project.

We are using below agora sdk
implementation 'io.agora.rtc:full-sdk:3.6.0.1'
implementation "io.agora.rtm:rtm-sdk:1.4.0"

I used https://github.com/AgoraIO/RTM/tree/master/Agora-RTM-Tutorial-Android for RTM code reference.
I have copied the ChatManager class from the above code sample and used the same as like above sample app and sometimes throw an exception (throw new RuntimeException("NEED TO check rtm sdk init fatal error\n" + Log.getStackTraceString(e))) in the init() method in our play store app.

public void init() {
        String appID = mContext.getString(R.string.agora_app_id);

        try {
            mRtmClient = RtmClient.createInstance(mContext, appID, new RtmClientListener() {
                @Override
                public void onConnectionStateChanged(int state, int reason) {
                    for (RtmClientListener listener : mListenerList) {
                        listener.onConnectionStateChanged(state, reason);
                    }
                }

                @Override
                public void onMessageReceived(RtmMessage rtmMessage, String peerId) {
                    if (mListenerList.isEmpty()) {
                        // If currently there is no callback to handle this
                        // message, this message is unread yet. Here we also
                        // take it as an offline message.
                        mMessagePool.insertOfflineMessage(rtmMessage, peerId);
                    } else {
                        for (RtmClientListener listener : mListenerList) {
                            listener.onMessageReceived(rtmMessage, peerId);
                        }
                    }
                }

                @Override
                public void onImageMessageReceivedFromPeer(final RtmImageMessage rtmImageMessage, final String peerId) {
                    if (mListenerList.isEmpty()) {
                        // If currently there is no callback to handle this
                        // message, this message is unread yet. Here we also
                        // take it as an offline message.
                        mMessagePool.insertOfflineMessage(rtmImageMessage, peerId);
                    } else {
                        for (RtmClientListener listener : mListenerList) {
                            listener.onImageMessageReceivedFromPeer(rtmImageMessage, peerId);
                        }
                    }
                }

                @Override
                public void onFileMessageReceivedFromPeer(RtmFileMessage rtmFileMessage, String s) {

                }

                @Override
                public void onMediaUploadingProgress(RtmMediaOperationProgress rtmMediaOperationProgress, long l) {

                }

                @Override
                public void onMediaDownloadingProgress(RtmMediaOperationProgress rtmMediaOperationProgress, long l) {

                }

                @Override
                public void onTokenExpired() {

                }

                @Override
                public void onPeersOnlineStatusChanged(Map<String, Integer> status) {

                }
            });

            if (BuildConfig.DEBUG) {
                mRtmClient.setParameters("{\"rtm.log_filter\": 65535}");
            }
        } catch (Exception e) {
            Log.e(TAG, Log.getStackTraceString(e));
            throw new RuntimeException("NEED TO check rtm sdk init fatal error\n" + Log.getStackTraceString(e));
        }

        // Global option, mainly used to determine whether
        // to support offline messages now.
        mSendMsgOptions = new SendMessageOptions();
    }

Tell me if you want any other information.

@shiv71
Copy link
Author

shiv71 commented May 6, 2022

@plutoless have you look this issue.

@plutoless
Copy link
Contributor

@shiv71 sorry for late response.
what params did you pass when create rtm instance? also does it work if you run our demo directly?

@shiv71
Copy link
Author

shiv71 commented May 9, 2022

@plutoless
I am passing context and agora app id.
It is working fine in your demo and our app but we got two users crashing in our play store app in firebase crashlytics.

Screenshot 2022-05-09 at 11 19 55 AM
Screenshot 2022-05-09 at 11 20 30 AM

@plutoless
Copy link
Contributor

@shiv71 ok i see. so it's not constantly reproducible but only happening randomly on your online apps?

@shiv71
Copy link
Author

shiv71 commented May 9, 2022

@plutoless Yes, you are right.

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

2 participants