gpt4 book ai didi

android - 使用不直接提供 APK 的自定义 URL 处理延迟深层链接

转载 作者:行者123 更新时间:2023-12-01 18:43:29 24 4
gpt4 key购买 nike

我正在使用 Branch.io 为我的 Android 应用实现延迟深层链接

我正在研究用户单击链接但未安装应用程序的用例(安装应用程序时我的链接已经可以使用)。目前我的应用程序未托管在 Play 商店上,而是托管在 Fabric 中。因此,我设置了深层链接以将用户重定向到如下网址: https://betas.to/ ...这样他最终就可以下载 Beta,然后下载应用程序。

不幸的是,我无法使以下用例发挥作用:

-> 用户从 Android 设备(无应用)点击深层链接

-> 用户访问 Fabric 网页并提供他的电子邮件进行测试

-> 用户打开 Fabric 电子邮件

-> 用户下载 Beta(可选)

-> 用户下载 Beta 版应用

-> 应用程序启动,并考虑延迟的深层链接

最后一步出现问题:不再考虑初始深层链接。我猜这是因为应用程序最终没有从链接打开。

我可以期望这个流程以某种方式工作吗?如果没有,我想知道我在 Branch 仪表板中提供的 URL 是否必须直接指向 APK 文件。

更新1

我刚刚意识到,当我测试延迟的深层链接(在 Branch deferred deeplink testing procedure 之后)时,我遇到了与分支相关的错误。仅当我在单击链接后立即从 Android Studio 安装应用程序时,才会发生此错误。我觉得有些东西正在阻止 Branch 正确捕获应用程序安装事件。

这是我得到的:

Rejecting re-init on previously-failed class java.lang.Class: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/android/installreferrer/api/InstallReferrerStateListener; at void io.branch.referral.InstallListener.captureInstallReferrer(android.content.Context, long, io.branch.referral.InstallListener$IInstallReferrerEvents) (InstallListener.java:54) at void io.branch.referral.Branch.registerAppInit(io.branch.referral.Branch$BranchReferralInitListener, io.branch.referral.ServerRequest$PROCESS_WAIT_LOCK) (Branch.java:2318) at void io.branch.referral.Branch.initializeSession(io.branch.referral.Branch$BranchReferralInitListener) (Branch.java:2272) at void io.branch.referral.Branch.initUserSessionInternal(io.branch.referral.Branch$BranchReferralInitListener, android.app.Activity, boolean) (Branch.java:1255) at boolean io.branch.referral.Branch.initSession(io.branch.referral.Branch$BranchReferralInitListener, android.app.Activity) (Branch.java:917) at boolean io.branch.referral.Branch.initSessionWithData(android.net.Uri, android.app.Activity) (Branch.java:1037) at void io.branch.referral.Branch.startSession(android.app.Activity) (Branch.java:2522) at void io.branch.referral.Branch.access$1000(io.branch.referral.Branch, android.app.Activity) (Branch.java:73) at void io.branch.referral.Branch$BranchActivityLifeCycleObserver.onActivityStarted(android.app.Activity) (Branch.java:2458) at void android.app.Application.dispatchActivityStarted(android.app.Activity) (Application.java:231) at void android.app.Activity.onStart() (Activity.java:1271) at void android.support.v4.app.FragmentActivity.onStart() (FragmentActivity.java:564) at void android.support.v7.app.AppCompatActivity.onStart() (AppCompatActivity.java:177) at void com...MyActivity.onStart() (MyActivity.java:48) at void android.app.Instrumentation.callActivityOnStart(android.app.Activity) (Instrumentation.java:1256) at void android.app.Activity.performStart() (Activity.java:6972) at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2937) at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3045) at void android.app.ActivityThread.-wrap14(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1) at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1642) at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102) at void android.os.Looper.loop() (Looper.java:154) at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6776) at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2) at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1496) at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1386) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.installreferrer.api.InstallReferrerStateListener" on path: DexPathList[[zip file "/data/app/com.myapp.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp.debug-1/lib/arm, /data/app/com.myapp.debug-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]] at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56) at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380) at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312) at void io.branch.referral.InstallListener.captureInstallReferrer(android.content.Context, long, io.branch.referral.InstallListener$IInstallReferrerEvents) (InstallListener.java:54) at void io.branch.referral.Branch.registerAppInit(io.branch.referral.Branch$BranchReferralInitListener, io.branch.referral.ServerRequest$PROCESS_WAIT_LOCK) (Branch.java:2318) at void io.branch.referral.Branch.initializeSession(io.branch.referral.Branch$BranchReferralInitListener) (Branch.java:2272) at void io.branch.referral.Branch.initUserSessionInternal(io.branch.referral.Branch$BranchReferralInitListener, android.app.Activity, boolean) (Branch.java:1255) at boolean io.branch.referral.Branch.initSession(io.branch.referral.Branch$BranchReferralInitListener, android.app.Activity) (Branch.java:917) at boolean io.branch.referral.Branch.initSessionWithData(android.net.Uri, android.app.Activity) (Branch.java:1037) at void io.branch.referral.Branch.startSession(android.app.Activity) (Branch.java:2522) at void io.branch.referral.Branch.access$1000(io.branch.referral.Branch, android.app.Activity) (Branch.java:73) at void io.branch.referral.Branch$BranchActivityLifeCycleObserver.onActivityStarted(android.app.Activity) (Branch.java:2458) at void android.app.Application.dispatchActivityStarted(android.app.Activity) (Application.java:231) at void android.app.Activity.onStart() (Activity.java:1271) at void android.support.v4.app.FragmentActivity.onStart() (FragmentActivity.java:564) at void android.support.v7.app.AppCompatActivity.onStart() (AppCompatActivity.java:177) at void com.....MyActivity.onStart() (MyActivity.java:48) at void android.app.Instrumentation.callActivityOnStart(android.app.Activity) (Instrumentation.java:1256) at void android.app.Activity.performStart() (Activity.java:6972) at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2937) at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3045) at void android.app.ActivityThread.-wrap14(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1) at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1642) at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102) at void android.os.Looper.loop() (Looper.java:154) at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6776) at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2) at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1496) at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1386)

下面一行是:

BranchSDK: Failed resolution of: Lcom/android/installreferrer/api/InstallReferrerClient;

最佳答案

缺少的类 (com.android.installreferrer.InstallReferrerClient) 是 Branch 的依赖项,但不会自动包含。您必须自己将其添加到您的构建中。

implementation 'com.android.installreferrer:installreferrer:1.0'

参见 Branch's gradle file .

已添加到 version 2.17 ,但文档似乎没有跟上。

在阅读提交之后,这个堆栈跟踪可能有点转移注意力。该库捕获 ClassNotFound 异常并记住该类不可用。它也有助于打印异常。

但是,install referrer package涉及跨安装跟踪引荐来源网址,因此与您的重现步骤相符。

关于android - 使用不直接提供 APK 的自定义 URL 处理延迟深层链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48906460/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com