chat-sdk-android icon indicating copy to clipboard operation
chat-sdk-android copied to clipboard

Everythings setup but it's crashing on start?

Open RyanElliott94 opened this issue 9 years ago • 3 comments

Every time i try to run the app i get this error: E/AndroidRuntime: FATAL EXCEPTION: main Process: com.skintmedia.voice, PID: 15447 java.lang.RuntimeException: Unable to resume activity {com.skintmedia.voice/com.braunster.chatsdk.activities.ChatSDKLoginActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.facebook.UiLifecycleHelper.onResume()' on a null object reference at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3121) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3152) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2499) at android.app.ActivityThread.access$900(ActivityThread.java:157) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5551) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.facebook.UiLifecycleHelper.onResume()' on a null object reference at com.braunster.chatsdk.activities.ChatSDKBaseActivity.onResume(ChatSDKBaseActivity.java:182) at com.braunster.chatsdk.activities.abstracted.ChatSDKAbstractLoginActivity.onResume(ChatSDKAbstractLoginActivity.java:63) at com.braunster.chatsdk.activities.ChatSDKLoginActivity.onResume(ChatSDKLoginActivity.java:107) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1259) at android.app.Activity.performResume(Activity.java:6347) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3110) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3152)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2499)  at android.app.ActivityThread.access$900(ActivityThread.java:157)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5551)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) 

But i don't know why?

RyanElliott94 avatar Mar 02 '17 17:03 RyanElliott94

Hello @SimplisticApps,

The first thing to do is to download the Android app and then run it from scratch. It should compile as the configuration has been set up correctly to our systems. If you can confirm that the base project compiles then we can narrow down whether the error is coming from the project or some modifications you have made to it.

The next thing to do is watch the youtube video of adding the project to your project. You can find it here. This will go through adding the Android to your custom project. Once you have completed this you should be able to compile your project including the Android Chat SDK. The corresponding tutorial can be found on our wiki page here.

If you can go through those steps first and then comment back on this thread it will help narrow down a lot of the issues that might be causing this error.

Simon

simonsmiley64 avatar Mar 02 '17 22:03 simonsmiley64

Hi, thanks for replying. So after looking it was all the UIHelper code for facebook, at the momemnt i have removed that code from the onResume methods and now the app runs and works but if it's code that i genuinely need then i will re-add it.

Update: So i decided to do what you said and start from scratch and try everything again this time with everything right, nothing has been modified or added other than the setup code but I still get an error, this time the error is on line: 44 on ChatSDKLoginActivity which is this line of code:

enableFacebookIntegration(getNetworkAdapter().facebookEnabled()); and it shows up in the log as:

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.skintmedia.voice, PID: 13504 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.skintmedia.voice/com.braunster.chatsdk.activities.ChatSDKLoginActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.braunster.chatsdk.network.AbstractNetworkAdapter.facebookEnabled()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2434) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494) at android.app.ActivityThread.access$900(ActivityThread.java:157) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5551) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.braunster.chatsdk.network.AbstractNetworkAdapter.facebookEnabled()' on a null object reference at com.braunster.chatsdk.activities.ChatSDKLoginActivity.onCreate(ChatSDKLoginActivity.java:44) at android.app.Activity.performCreate(Activity.java:6272) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)  at android.app.ActivityThread.access$900(ActivityThread.java:157)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5551)`

Update 2: The app and SDK is now working as it should do!

Thanks for you're help Simon!

RyanElliott94 avatar Mar 03 '17 11:03 RyanElliott94

Hello can you please tell me how you remove that error in lineenableFacebookIntegration(getNetworkAdapter().facebookEnabled());. Because i also got same error please help me the error is Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.braunster.chatsdk.network.AbstractNetworkAdapter.facebookEnabled()' on a null object reference at com.braunster.chatsdk.activities.ChatSDKLoginActivity.onCreate(ChatSDKLoginActivity.java:44)

sadhanareddy007 avatar Aug 31 '17 07:08 sadhanareddy007