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

Unable to find explicit activity class - im.crisp.client.external.ChatActivity

Open pro3k opened this issue 11 months ago • 2 comments
trafficstars

build.gradle(app lever) implementation('com.amazon:fortpayment:+:release@aar') { transitive = true }

My current build version is 8.1.2 with AGP version 8.2

I am getting an error while starting the chat activity. android.content.ActivityNotFoundException: Unable to find explicit activity class {com.isteel.isteelbox/im.crisp.client.external.ChatActivity}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared <intent-filter>? at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2249) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1878) at android.app.Activity.startActivityForResult(Activity.java:5760) at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:780) at android.app.Activity.startActivityForResult(Activity.java:5718) at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:761) at android.app.Activity.startActivity(Activity.java:6216) at android.app.Activity.startActivity(Activity.java:6183) at com.lattice.isteelbox.ui.view.main.MainActivity.lambda$bindEvent$9$com-lattice-isteelbox-ui-view-main-MainActivity(MainActivity.java:300) at com.lattice.isteelbox.ui.view.main.MainActivity$$ExternalSyntheticLambda6.onChanged(Unknown Source:4) at androidx.lifecycle.LiveData.considerNotify(LiveData.java:133) at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:151) at androidx.lifecycle.LiveData.setValue(LiveData.java:309) at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:50) at com.lattice.isteelbox.ui.view.main.MainActivityViewModel.launchChat(MainActivityViewModel.java:113) at com.lattice.isteelbox.databinding.ActivityMainBindingImpl._internalCallbackOnClick(ActivityMainBindingImpl.java:268) at com.lattice.isteelbox.generated.callback.OnClickListener.onClick(OnClickListener.java:11) at android.view.View.performClick(View.java:8047) at android.view.View.performClickInternal(View.java:8024) at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0) at android.view.View$PerformClick.run(View.java:31890) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.app.ActivityThread.main(ActivityThread.java:8918) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

Here is my code snippet MainActivity.java viewModel.getActivityToStartChat().observe(this, chatActivity -> { if(chatActivity != null) { Intent startChatActivity = new Intent(this, chatActivity); startActivity(startChatActivity); viewModel.resetActivityTrigger(); } });

AndroidManifest.xml <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider;${applicationId}.im.crisp.client.uploadfileprovider" android:exported="false" android:grantUriPermissions="true" tools:replace="android:authorities" > <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" tools:replace="android:resource" /> </provider>

file_path.xml <?xml version="1.0" encoding="utf-8"?> <paths xmlns:android="http://schemas.android.com/apk/res/android"> <external-path name="external_files" path="." /> <files-path name="crisp_sdk_attachments" path="im.crisp.client/attachments/" /> </paths>

pro3k avatar Dec 18 '24 10:12 pro3k

Mmh, this is not our SDK at all ^^"

implementation('com.amazon:fortpayment:+:release@aar') { transitive = true }

You have to import it like this: implementation('im.crisp:crisp-sdk:2.0.8')

Keep also in mind that you need to follow the Step 7 about the File provider only if you already declare one for your app as only one can exists per app. If you don't have one, you don't need to declare it, Crisp SDK already declares one for you, that's what the tools:replace="android:resource" attribute is for, replacing the one Crisp SDK is declaring ;)

In your code snippet, what is behind your viewModel.getActivityToStartChat() which returns chatActivity? Can you share the code with us to better understand the issue? As explained in Step 5, you should start the activity like this:

Intent intent = new Intent(this, im.crisp.client.external.ChatActivity.class);
startActivity(intent);

Doc1faux avatar Dec 19 '24 11:12 Doc1faux

Hello @Doc1faux Thank you to get back to me. Sorry for the late response to you.

viewModel.getActivityToStartChat() This is just a method to start an Intent to go to the ChatActivity.

I cross-checked the document and everything are same as the document.

Step 7: File provider code snippet from Manifest file. image

file_path.xml image

Button and its event declaration from activity.xml to launch ChatActivity.java image

Method which will launch the ChatActivity.java on tap of the button from viewModel image

Method in MainActivity.java class to get click from the viewModel. image

Let me know if any specific details or clarification are needed.

pro3k avatar Dec 23 '24 08:12 pro3k