Giter VIP home page Giter VIP logo

Comments (11)

keyboardsurfer avatar keyboardsurfer commented on July 18, 2024

Thanks for reporting this. It seems like this is not an issue with the sample itself but one you're encountering in your own application.

Can you please give me some more information on your Activity / Fragment / Module setup & stacktrace over at StackOverflow and link it here?

from app-bundle-samples.

keyboardsurfer avatar keyboardsurfer commented on July 18, 2024

We need your input to act on this issue.
This issue will be closed soon unless there is further actionable input.

from app-bundle-samples.

Rishabh-sx avatar Rishabh-sx commented on July 18, 2024

Hi @keyboardsurfer @georgious1 , I am also facing this when navigating back to fragment.

I have added this in activity.
override fun onResume() { super.onResume() SplitCompat.install(context) }

But I am getting crash in API response.

from app-bundle-samples.

Rishabh-sx avatar Rishabh-sx commented on July 18, 2024

Any Standard way to fix this ?

from app-bundle-samples.

keyboardsurfer avatar keyboardsurfer commented on July 18, 2024

Is there a way for you to reproduce the issue within this sample or a clone of it?

from app-bundle-samples.

Rishabh-sx avatar Rishabh-sx commented on July 18, 2024

Hi @keyboardsurfer, Not in this sample but in our application we are facing this after following all the steps to turn on Dynamic Delivery.

from app-bundle-samples.

keyboardsurfer avatar keyboardsurfer commented on July 18, 2024

I understand this. What I'm asking you is to try and reproduce the issue on the sample at hand. If it's reproducible here we can take a closer look.

from app-bundle-samples.

Rishabh-sx avatar Rishabh-sx commented on July 18, 2024

Okay, let me check and get back to you.

from app-bundle-samples.

georgious1 avatar georgious1 commented on July 18, 2024

@Rishabh-sx i added workaround to fix this issue.
enable SplitCompat to have immediate access for code and resources
https://developer.android.com/guide/playcore/dynamic-delivery#activity_splitcompat

Android docs says :
"As long as you enable SplitCompat for your base application context and the activities in your dynamic feature module, after a request for an on demand module reports as INSTALLED, you can start using its code and resources as if it were a part of the base APK..."

BUT

  1. I enabled SplitCompat in my Application class, and my dynamic feature modules didnt have any activities, only fragments. But for sure i added following code to my activity(which was not part of DFModule).
override fun attachBaseContext(baseContext: Context) {
        super.attachBaseContext(baseContext)
        SplitCompat.installActivity(baseContext)
    }

AND
2) When receive SplitInstallSessionStatus.INSTALLED status i immediately called
SplitCompat.install(context.applicationContext) with application context. And only after that i was able to use any code from DFModule

  1. Added following to Fragment from DFModule
override fun onAttach(context: Context?) {
        super.onAttach(context)
        SplitCompat.install(context)

Actually i think just number (2) did all the trick, and enabling SplitCompat in fragments looks like redundant, but wont create any issues.

from app-bundle-samples.

georgious1 avatar georgious1 commented on July 18, 2024

Ah, and small update here, rechecked docs. Maybe its new addition, but it describes step (2) from example above :
".. If you want to access assets or resources that exist in the newly installed module from a different installed module of your app, you must do so using the application context. The context of the component that's trying to access the resources will not yet be updated. Alternatively, you can recreate that component or install SplitCompat upon it after the dynamic feature module install. "

So having next code should be enough :

SplitInstallStateUpdatedListener { state ->
       when (state.status()) {
           SplitInstallSessionStatus.INSTALLED -> {
               SplitCompat.install(context.applicationContext)

               // CAN USE CODE FROM DFModule
           }
       }
   }

from app-bundle-samples.

Rishabh-sx avatar Rishabh-sx commented on July 18, 2024

Hi @georgious1 , Thanks for sharing this information. Let me share this with my team and ask them to check if we are missing something.

from app-bundle-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.