简体   繁体   English

App Bundle:应用程序类可以在动态功能模块中吗? 应用程序包崩溃

[英]App Bundle: Can Application class be in a Dynamic Feature module? App bundle crashes

While refactoring your code for App Bundles, can the custom Application class remain in the com.android.dynamic-feature module or should it be only in the com.android.application base module?在为 App Bundle 重构您的代码时,自定义 Application 类可以保留在com.android.dynamic-feature模块中还是应该只在com.android.application基础模块中?

I see the base's merged manifest having the custom Application class, but when I start the app, I see the error message below in an infinite loop.我看到 base 的合并清单具有自定义 Application 类,但是当我启动应用程序时,我在无限循环中看到下面的错误消息。 Emulator ultimately crashes.模拟器最终崩溃。

Should the LaunchActivity which has the intent.action.MAIN and LAUNCHER also be in the com.android.application module, or can it be in the com.android.dynamic-feature module?具有intent.action.MAIN and LAUNCHER的 LaunchActivity 是否也应该在com.android.application模块中,还是可以在com.android.dynamic-feature模块中?

2020-01-08 15:45:16.134 ? E/<apppackage>: Unknown bits set in runtime_flags: 0x8000
2020-01-08 15:45:16.136 ? W/<apppackage>: Unexpected CPU variant for X86 using defaults: x86

2020-01-08 15:45:16.663 ? I/lowmemorykiller: Suppressed 83 failed kill reports

2020-01-08 15:45:16.781 ? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 923592)
2020-01-08 15:45:16.786 ? E/ActivityManager: Exception thrown during bind of ProcessRecord{a6f5e75 13002:<apppackage>/u0a166}
    android.os.TransactionTooLargeException: data parcel size 923592 bytes
        at android.os.BinderProxy.transactNative(Native Method)
        at android.os.BinderProxy.transact(BinderProxy.java:510)
        at android.app.IApplicationThread$Stub$Proxy.bindApplication(IApplicationThread.java:1479)
        at com.android.server.am.ActivityManagerService.attachApplicationLocked(ActivityManagerService.java:5058)
        at com.android.server.am.ActivityManagerService.attachApplication(ActivityManagerService.java:5180)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2003)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2741)
        at android.os.Binder.execTransactInternal(Binder.java:1021)
        at android.os.Binder.execTransact(Binder.java:994)

The application class of dynamic feature module will remain inside of itself..动态功能模块的应用程序类将保留在其内部。

whenever you will download that module, it will download all the resources inside of that module, and after that androidManifest.xml files of both: base app module and the dynamic module will be merged...This is only useful while implementing with aab (Android App Bundle).每当您下载该模块时,它都会下载该模块内的所有资源,然后两者的 androidManifest.xml 文件:基本应用程序模块和动态模块将被合并......这仅在使用 aab 实现时有用( Android 应用程序包)。

also, you wherever you extend application class...you must implement one override method as below...此外,无论您在何处扩展应用程序类……您都必须实现一种覆盖方法,如下所示……

override fun attachBaseContext(base: Context) {
        super.attachBaseContext(base)
        SplitCompat.install(this)
    }

make sure you don't have any launcher activity in dynamic feature module (because it will create another app icon on the phone which doesn't look appropriate).确保您在动态功能模块中没有任何启动器活动(因为它会在手机上创建另一个看起来不合适的应用程序图标)。
I have faced this earlier and It works for me...I hope you will have your solution.我早些时候遇到过这个问题,它对我有用......我希望你能得到你的解决方案。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 App Bundle动态功能模块中的访问资源 - Access Resources In Dynamic Feature Module of App Bundle 签署App Bundle基本模块和动态功能模块 - Signing The App Bundle Base Module And Dynamic Feature Module App Bundle,在动态功能模块中,安装前可用的模块 - App Bundle, In Dynamic Feature Module, Module available before install 与动态功能模块(App Bundle)一起安装时出现“没有足够的存储空间” - "Not enough storage space" when installed with Dynamic Feature Module (App Bundle) 将动态功能插入到现有应用程序包中 - Inserting a dynamic feature to an esixting app bundle App Bundle - 动态功能模块:在动态功能模块错误中找不到基础项目 - App Bundle - Dynamic feature modules : Base project not found in dynamic feature module error Android App Bundle:Google Play 150MB 限制似乎包括动态功能模块大小? - Android App Bundle: Google Play 150MB limit seems to include the Dynamic Feature Module size? 加载动态功能时出错。 应用程式套件Android - Error in Loading Dynamic feature. App Bundle Android 通过意图发送捆绑包时,应用崩溃 - App crashes when sending a bundle through intent Android App Bundle(.aab)在设备上崩溃 - Android App Bundle (.aab) crashes on device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM