android - 将 Fabric with Multidex 与导出的 Unity 项目一起使用

标签 android manifest unity-game-engine crashlytics twitter-fabric

我已经导出我的 Unity 项目以便能够使用 multidex。问题是当我已经为 fabric 设置了这个“io.fabric.unity.android.FabricApplication”时,我必须将项目的 androidmanifest 中的 android:name 设置为“android.support.multidex.MultiDexApplication”。

我曾尝试手动初始化 Fabric,但随后出现此错误: AndroidJavaException:io.fabric.unity.android.FabricInitializationException:Fabric 未找到有效的应用程序上下文。

我发现有人遇到了类似的问题,但没有得到解决: https://twittercommunity.com/t/unity-android-plugin-conflicts/79947?source_topic_id=83751

预先感谢您的帮助!

最佳答案

将下一行添加到您的 Application 方法中:

protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    // this one is needed to enable multidex in your application
    MultiDex.install(this);
}

public void onCreate() {
    super.onCreate();
    // this one is needed to init the Fabric SDK
    FabricInitializer.initializeFabric(this, FabricInitializer.Caller.Unity);
}

此外,您可以在此处查看另一种解决方案,我创建了一个小的 GitHub repo并说明如何单击几下即可完成。

关于android - 将 Fabric with Multidex 与导出的 Unity 项目一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42971043/

相关文章:

android - Xamarin Android Theme.AppCompat 错误 - 仅在运行时

android - 垂直线性布局中的权重

Scala:覆盖参数化类的equals函数的删除问题

android - 将 Unity IAP 从 1.23.5 更新到 2.2.4 时出现构建错误, list 合并失败

android - 如何从 Android 上的通知栏为 Fragments 重新创建向后导航?

带有 Google Play : Google Play services is missing 的 Android Studio

android - Android 中自动读取 OTP/SMS

java - 使用spring boot loader WarLauncher时如何加载war文件之外的属性文件?

android - Unity 中的原生 C++ 和 Java Android 库

unity-game-engine - 球面映射