You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native深度链接报错:ActivityNotFoundException问题求助

React Native深度链接ActivityNotFoundException排查方案

错误日志

Received HALT command code 2
2022-12-23 13:32:49.634 17983-17983 AcceptInvitation        pid-17983                            E  Activity not found to handle Intent action [CONTEXT service_id=77 ]
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.goalster_enterprise/com.goalster_enterprise.MainActivity}; 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:2171)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1805)
    at android.app.Activity.startActivityForResult(Activity.java:5583)
    at haj.platform_startActivityForResult(:com.google.android.gms@224913044@22.49.13 (190400-493924051):2)
    at hai.startActivityForResult(:com.google.android.gms@224913044@22.49.13 (190400-493924051):2)
    at com.google.android.chimera.android.Activity.startActivityForResult(:com.google.android.gms@224913044@22.49.13 (190400-493924051):2)
    at heu.startActivityForResult(:com.google.android.gms@224913044@22.49.13 (190400-493924051):2)
    at hai.public_startActivityForResult(:com.google.android.gms@224913044@22.49.13 (190400-493924051):2)
    at haj.startActivityForResult(:com.google.android.gms@224913044@22.49.13 (190400-493924051):3)
    at android.app.Activity.startActivityForResult(Activity.java:5541)
    at haj.platform_startActivityForResult(:com.google.android.gms@224913044@22.49.13 (190400-493924051):1)
    at hai.startActivityForResult(:com.google.android.gms@224913044@22.49.13 (190400-493924051):1)
    at com.google.android.chimera.android.Activity.startActivityForResult(:com.google.android.gms@224913044@22.49.13 (190400-493924051):1)
    at heu.startActivityForResult(:com.google.android.gms@224913044@22.49.13 (190400-493924051):1)
    at hai.public_startActivityForResult(:com.google.android.gms@224913044@22.49.13 (190400-493924051):1)
    at haj.startActivityForResult(:com.google.android.gms@224913044@22.49.13 (190400-493924051):1)
    at android.app.Activity.startActivity(Activity.java:6039)
    at haj.platform_startActivity(:com.google.android.gms@224913044@22.49.13 (190400-493924051):2)
    at hai.startActivity(:com.google.android.gms@224913044@22.49.13 (190400-493924051):2)
    at com.google.android.chimera.android.Activity.startActivity(:com.google.android.gms@224913044@22.49.13 (190400-493924051):2)
    at hai.public_startActivity(:com.google.android.gms@224913044@22.49.13 (190400-493924051):2)
    at haj.startActivity(:com.google.android.gms@224913044@22.49.13 (190400-493924051):3)
    at android.app.Activity.startActivity(Activity.java:6006)
    at haj.platform_startActivity(:com.google.android.gms@224913044@22.49.13 (190400-493924051):1)
    at hai.startActivity(:com.google.android.gms@224913044@22.49.13 (190400-493924051):1)
    at com.google.android.chimera.android.Activity.startActivity(:com.google.android.gms@224913044@22.49.13 (190400-493924051):1)
    at kjx.x(:com.google.android.gms@224913044@22.49.13 (190400-493924051):4)
    at kjz.onPostExecute(:com.google.android.gms@224913044@22.49.13 (190400-493924051):3)
    at android.os.AsyncTask.finish(AsyncTask.java:771)
    at android.os.AsyncTask.-$$Nest$mfinish(Unknown Source:0)
    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8741)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

排查步骤

  • 验证Intent Filter配置完整性
    确认MainActivity的包含以下必要项:

    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    

    同时检查标签的scheme、host、path参数是否与触发的深度链接完全匹配,避免拼写或格式错误。

  • 核对包名一致性
    错误日志中包名为com.goalster_enterprise,需确认:

    • AndroidManifest.xml根节点的package属性值一致
    • app/build.gradle中applicationId与包名完全匹配,注意大小写、下划线等细节
  • 检查MainActivity类路径
    确认AndroidManifest.xml中MainActivity的android:name属性为正确路径,比如.MainActivity或完整的com.goalster_enterprise.MainActivity,需与实际文件目录结构对应。

  • 清理重建项目
    执行以下命令清理缓存并重新编译:

    ./gradlew clean
    npx react-native run-android
    
  • 排查重复Intent Filter
    检查项目中是否有其他Activity配置了相同的Intent Filter,导致系统无法确定目标Activity,确保仅MainActivity处理该深度链接。

  • 手动测试深度链接
    使用adb命令直接触发深度链接,验证Intent是否能正确匹配:

    adb shell am start -W -a android.intent.action.VIEW -d "your-scheme://your-host/path" com.goalster_enterprise
    

    观察命令执行结果和logcat输出,定位具体匹配问题。

内容的提问来源于stack exchange,提问作者Kalpesh Rajput

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 04:20:17