ionic-framework - 找不到错误 io.branch.referral.InstallListener 类崩溃 Ionic v5

标签 ionic-framework

我有一个 ionic 应用程序和分支 SDK 的问题,在测试环境中,一切都按预期工作,但用户在 PROD 中不断崩溃。

正如分支文档中所述,我已经在 app.component.ts 中初始化了平台就绪事件的分支:

app.component.ts
import { Component } from "@angular/core";
import { Platform } from "ionic-angular";
import { StatusBar, Splashscreen } from "ionic-native";

import { TabsPage } from "../pages/tabs/tabs";

@Component({
  template: `<ion-nav [root]="rootPage"></ion-nav>`
})
export class MyApp {
  rootPage = TabsPage;

  constructor(platform: Platform) {
    platform.ready().then(() => {
      StatusBar.styleDefault();
      Splashscreen.hide();
      branchInit();
    });

    platform.resume.subscribe(() => {
      branchInit();
    });

    // Branch initialization
    const branchInit = () => {
      // only on devices
      if (!platform.is("cordova")) {
        return;
      }
      const Branch = window["Branch"];
      Branch.initSession().then(data => {
        if (data["+clicked_branch_link"]) {
          // read deep link data on click
          alert("Deep Link Data: " + JSON.stringify(data));
        }
      });
    };
  }
}

错误如下:

Unable to instantiate receiver io.branch.referral.InstallListener: java.lang.ClassNotFoundException: Didn't find class "io.branch.referral.InstallListener"

这是我的 ionic 信息

    Ionic:

   Ionic CLI                     : 5.4.15 (/Users/path/.nvm/versions/node/v9.6.0/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.11.5
   @angular-devkit/build-angular : 0.12.4
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.2.4
   @ionic/angular-toolkit        : 1.3.0

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.1.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.1, (and 30 other plugins)

Utility:

   cordova-res                          : not installed
   native-run (update available: 0.3.0) : 0.2.7

System:

   Android SDK Tools : 26.1.1 (/Users/path/Library/Android/sdk)
   NodeJS            : v9.6.0 (/Users/path/.nvm/versions/node/v9.6.0/bin/node)
   npm               : 2.15.12
   OS                : macOS High Sierra
   Xcode             : Xcode 10.1 Build version 10B61

最佳答案

我没有找到关于该问题的良好文档,我不确定删除该库是否会导致无法获得安装引荐来源网址,但经过一番调查后,我决定从 AndroidManifest.xml 中删除这些行

<receiver android:name="io.branch.referral.InstallListener" android:exported="true">
  <intent-filter>
    <action android:name="com.android.vending.INSTALL_REFERRER" />
  </intent-filter>
</receiver>

以下链接讨论了分支机构发送的通信和过时的文档,并暗示了上述解决方案。

https://github.com/BranchMetrics/unity-branch-deep-linking-attribution/issues/171

关于ionic-framework - 找不到错误 io.branch.referral.InstallListener 类崩溃 Ionic v5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60326010/

相关文章:

javascript - 基于ID的多维数组中的对象未被删除-Angular 4/Ionic 3

javascript - 使用 angularjs 和 ionicframework 解析远程或本地 XML

ios - 使用 ionic 模拟 iOS,当前模拟失败,错误为 : Timed out waiting for device to boot.

ionic-framework - Ionic 2/3/4 自定义返回按钮

ionic-framework - 如何创建一次加载器并在整个应用程序中使用它? - ionic 3

javascript - 在 Ionic 的自定义按钮上实现 Css 和 Js 功能

typescript - Cordova 插件-qrscanner : error: no suitable constructor found for DefaultDecoderFactory(ArrayList<BarcodeFormat>, <空>,<空>)

javascript - 如何使用 Angularjs ionic 缓存图像?

angular - 在另一个 promise 中立即更新该值后,将 from 运算符与 promise 一起使用时,Observable 获得错误的值

javascript - 将 json 响应数组的值映射到预定义接口(interface)