简体   繁体   English

App Bundle动态功能模块中的访问资源

[英]Access Resources In Dynamic Feature Module of App Bundle

My usage scenario is a bit complicated. 我的使用场景有点复杂。

In the dynamic form, I only have some views and resources. 在动态形式中,我只有一些视图和资源。 Those views should have access to those resources. 这些视图应该可以访问那些资源。 In my base module, I will use these views from the activity of a basic module. 在基本模块中,我将从基本模块的活动中使用这些视图。 Both my application and activity replace the attachBaseContext method. 我的应用程序和活动都替换了attachBaseContext方法。

But when I download and install the dynamic form, my views can not access resources using the task context. 但是,当我下载并安装动态表单时,我的视图无法使用任务上下文访问资源。 However, resources are accessible from applicationContext. 但是,可以从applicationContext访问资源。

I do not understand how SplitCompat works. 我不了解SplitCompat的工作原理。 So the classes and resources loaded by the dynamic module connect only to applicationContext? 那么动态模块加载的类和资源仅连接到applicationContext吗?

This problem is probably caused by an Android Studio bug. 此问题可能是由Android Studio错误引起的。 Clean the project and invalidate the cache, or build the project again. 清理项目并使缓存无效,或再次构建项目。

You can take a look at how Dynamic Features are implemented in this sample . 您可以看一下此示例中如何实现动态功能。

There's sample code on how to open some resources, located in a dynamic module, from the base module . 有关如何从基本模块中打开动态模块中的某些资源的示例代码。

Plus, the samples includes others dynamic modules with activities in implemented in Java/Kotlin and native. 另外,这些示例还包括其他动态模块,这些模块的活动以Java / Kotlin和本机实现。

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

相关问题 无法访问动态功能模块的资源 - Unable to access resources of dynamic-feature module 签署App Bundle基本模块和动态功能模块 - Signing The App Bundle Base Module And Dynamic Feature Module App Bundle,在动态功能模块中,安装前可用的模块 - App Bundle, In Dynamic Feature Module, Module available before install 动态特征模块第三方库无法访问资源 - Third party library of dynamic feature module cannot access resources 与动态功能模块(App Bundle)一起安装时出现“没有足够的存储空间” - "Not enough storage space" when installed with Dynamic Feature Module (App Bundle) App Bundle - 动态功能模块:在动态功能模块错误中找不到基础项目 - App Bundle - Dynamic feature modules : Base project not found in dynamic feature module error App Bundle:应用程序类可以在动态功能模块中吗? 应用程序包崩溃 - App Bundle: Can Application class be in a Dynamic Feature module? App bundle crashes Android App Bundle:Google Play 150MB 限制似乎包括动态功能模块大小? - Android App Bundle: Google Play 150MB limit seems to include the Dynamic Feature Module size? 将动态功能插入到现有应用程序包中 - Inserting a dynamic feature to an esixting app bundle 在动态功能模块中无法访问资源文件 - In Dynamic Feature Module can not access Resource file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM