【发布时间】:2019-02-22 17:01:10
【问题描述】:
我正在使用TrustedWebActivities,但我在三星 S8、S9 和 Pixel 2 设备上立即出现应用程序崩溃,并出现以下异常。一些研究表明,这可能发生在安装了不支持 TWA 的旧版 Chrome 并且后备方法失败的设备上。但我已经确认 Chrome 版本是 71(也适用于三星 S7、Pixel 3)。
java.lang.NullPointerException:
at android.support.customtabs.TrustedWebUtils.launchAsTrustedWebActivity (TrustedWebUtils.java:91)
at android.support.customtabs.trusted.LauncherActivity$TwaCustomTabsServiceConnection.onCustomTabsServiceConnected (LauncherActivity.java:192)
at android.support.customtabs.CustomTabsServiceConnection.onServiceConnected (CustomTabsServiceConnection.java:44)
at android.app.LoadedApk$ServiceDispatcher.doConnected (LoadedApk.java:1656)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run (LoadedApk.java:1685)
at android.os.Handler.handleCallback (Handler.java:789)
at android.os.Handler.dispatchMessage (Handler.java:98)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6938)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
我相信这发生在session 为空的行上,它是CustomTabsSession 类型的对象。这是source。
session.validateRelationship(CustomTabsService.RELATION_HANDLE_ALL_URLS, uri, null);
感谢任何帮助。谢谢。
【问题讨论】:
-
您使用的是哪个版本的支持库?您是否在使用随支持库 (github.com/GoogleChrome/custom-tabs-client/blob/master/…) 提供的 LauncherActivity
标签: android google-chrome progressive-web-apps trusted-web-activity