0

I am building the app with Dynamic Feature Module and uploading it on internal app sharing for testing. I am able to download the Dynamic module during the app but, When I am going to a particular fragment, I am getting the error

Fatal Exception: android.view.InflateException: Binary XML file line #104: Binary XML file line #104: Error inflating class <unknown>
Caused by android.view.InflateException: Binary XML file line #104: Error inflating class <unknown>

Caused by java.lang.reflect.InvocationTargetException
       at java.lang.reflect.Constructor.newInstance0(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
       at android.view.LayoutInflater.createView(LayoutInflater.java:645)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
       at com.sliceit.hns.helpAndSupport.view.ArticleFragment.onCreateView(ArticleFragment.kt:83)
       at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
       at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
       at androidx.fragment.app.FragmentManagerImpl.addAddedFragments(FragmentManagerImpl.java:2100)
       at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1874)
       at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1830)
       at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
       at androidx.fragment.app.FragmentManagerImpl$2.run(FragmentManagerImpl.java:150)
       at android.os.Handler.handleCallback(Handler.java:836)
       at android.os.Handler.dispatchMessage(Handler.java:103)
       at android.os.Looper.loop(Looper.java:203)
       at android.app.ActivityThread.main(ActivityThread.java:6251)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1075)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)


Caused by android.content.res.Resources$NotFoundException: Drawable (missing name) with resource ID #0x7e010012

Caused by android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7e010012
       at android.content.res.ResourcesImpl.getResourceName(ResourcesImpl.java:228)
       at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:687)
       at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:571)
       at android.content.res.Resources.loadDrawable(Resources.java:972)
       at android.content.res.TypedArray.getDrawable(TypedArray.java:931)
       at android.view.View.<init>(View.java:4226)
       at android.view.ViewGroup.<init>(ViewGroup.java:603)
       at android.view.ViewGroup.<init>(ViewGroup.java:599)
       at android.view.ViewGroup.<init>(ViewGroup.java:595)
       at androidx.constraintlayout.widget.ConstraintLayout.<init>(ConstraintLayout.java:575)
       at java.lang.reflect.Constructor.newInstance0(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
       at android.view.LayoutInflater.createView(LayoutInflater.java:645)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
       at com.sliceit.hns.helpAndSupport.view.ArticleFragment.onCreateView(ArticleFragment.kt:83)
       at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
       at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
       at androidx.fragment.app.FragmentManagerImpl.addAddedFragments(FragmentManagerImpl.java:2100)
       at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1874)
       at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1830)
       at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
       at androidx.fragment.app.FragmentManagerImpl$2.run(FragmentManagerImpl.java:150)
       at android.os.Handler.handleCallback(Handler.java:836)
       at android.os.Handler.dispatchMessage(Handler.java:103)
       at android.os.Looper.loop(Looper.java:203)
       at android.app.ActivityThread.main(ActivityThread.java:6251)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1075)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
...
104         <androidx.constraintlayout.widget.ConstraintLayout
105             android:id="@+id/viewOpenTicketsCl"
106             android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/white"
                android:visibility="gone"
                android:clipToPadding="false"
                android:padding="22dp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.5"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintVertical_bias="1.0">

                <Button
                    android:id="@+id/viewOpenTicketsBt"
                    style="@style/normal_app_button_full_width"
                    android:layout_width="match_parent"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:text="@string/view_open_tickets"
                    app:layout_constraintHorizontal_bias="0.5"
                    app:layout_constraintTop_toTopOf="parent" />

            </androidx.constraintlayout.widget.ConstraintLayout>
...

One interesting point to note here is that, when I update the app over the previous version, then I am not getting this exception. It is coming only in case of a clean install. Does that hint to a bug on internal-app-sharing? Or is it that something I am missing here?

Rishabh Maltare
  • 161
  • 2
  • 12
  • Does this answer your question? [Error inflating class androidx.constraintlayout.ConstraintLayout after migration to androidx](https://stackoverflow.com/questions/52882606/error-inflating-class-androidx-constraintlayout-constraintlayout-after-migration) – Khal Aug 27 '20 at 04:14
  • @Khal unfortunately not. The dependency for constraint layout is already added and is working fine on other screens. In fact, the parent of this screen is constraint layout. But it's giving me the exception at line 104. – Rishabh Maltare Aug 27 '20 at 04:43
  • try invalidate cache and restart – Khal Aug 27 '20 at 06:44
  • It hints at a bug in how you load the module after it's installed. How did you use SplitCompat? – Pierre Aug 27 '20 at 08:23
  • @Pierre This is how it is done: ``` override fun attachBaseContext(base: Context?) { super.attachBaseContext(base) SplitCompat.install(this) } ``` – Rishabh Maltare Aug 27 '20 at 08:57
  • @Khal this is happening with the CI build too. – Rishabh Maltare Aug 27 '20 at 08:59
  • 1
    unfortunately, This is an existing bug in feature modules. we were able to work around it by changing the fragmentManager from parentFragmentManager to activity?.supportFragmentManager(during fragment transaction). This solves our issue. but it randomly crashes at any other place in the code with ResourceNotFoundException. – Amritpal Singh Sep 07 '20 at 16:43

0 Answers0