Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resources$NotFoundException when accessing app module resource from dynamic feature module #1060

Open
juckrit opened this issue Aug 25, 2023 · 15 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@juckrit
Copy link

juckrit commented Aug 25, 2023

Description
I have composable function in dynamicFeature Module that show Image that image file is in app module
when I run "gradle recordPaparazziDebug" the test fail with Resources$NotFoundException

Steps to Reproduce

  1. clone this sample project https://github.com/juckrit/Poc_Paparazzi
  2. run gradle task "recordPaparazziDebug"

Expected behavior
The test should pass

Additional information:

  • Paparazzi Version: 1.3.1 and 1.3.2-SNAPSHOT
  • OS: Mac Os 13.3.1 (22E261)
  • Compile SDK: 33
  • Gradle Version: 8.0
  • Android Gradle Plugin Version: 8.1.0

Screenshots
Screenshot 2566-08-25 at 20 42 50

@juckrit juckrit added the bug Something isn't working label Aug 25, 2023
@jacobtabak
Copy link

jacobtabak commented Sep 8, 2023

EDIT: Solved by updating to the latest version of Paparazzi and plugin.

I have a similar issue.

I'm not using a dynamic feature module, but the resources being referenced are in a different module.

The problem manifested after upgrading to Gradle 8.3 and AGP 8.1.1.

android.content.res.Resources$NotFoundException: Could not resolve resource value: 0x7F06027E.
	at app//android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:1161)
	at app//android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:1137)
	at app//android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:1141)
	at app//android.content.res.Resources_Delegate.getColorStateList(Resources_Delegate.java:264)
	at app//android.content.res.Resources_Delegate.getColor(Resources_Delegate.java:242)
	at app//android.content.res.Resources.getColor(Resources.java:1065)
	at app//androidx.compose.ui.res.ColorResourceHelper.getColor-WaAFU9c(ColorResources.android.kt:51)
	at app//androidx.compose.ui.res.ColorResources_androidKt.colorResource(ColorResources.android.kt:40)
	at app//com.seatgeek.android.compose.theme.SeatGeekTheme$colorsCache$1.invoke(SeatGeekTheme.kt:64)
	at app//com.seatgeek.android.compose.theme.SeatGeekTheme$colorsCache$1.invoke(SeatGeekTheme.kt:61)
	at app//com.seatgeek.android.compose.extensions.ComposableCache.value(ComposableCache.kt:18)
	at app//com.seatgeek.android.compose.theme.SeatGeekTheme.getColors(SeatGeekTheme.kt:539)
	at app//com.seatgeek.android.design.abi.theme.DesignSystemThemeKt.DesignSystemTheme(DesignSystemTheme.kt:137)
	at app//com.seatgeek.android.compose.view.core.SgComposeEntrypointKt.ThemedContent(SgComposeEntrypoint.kt:59)
	at app//com.seatgeek.android.compose.view.core.SgComposeEntrypointKt.SgComposeEntrypoint(SgComposeEntrypoint.kt:45)
	at app//com.seatgeek.android.design.compose.preview.SgPreviewKt$SgPreview$1.invoke(SgPreview.kt:20)
	at app//com.seatgeek.android.design.compose.preview.SgPreviewKt$SgPreview$1.invoke(SgPreview.kt:19)
	at app//androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
	at app//androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
	at app//androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
	at app//com.seatgeek.android.design.compose.preview.SgPreviewKt.SgPreview(SgPreview.kt:19)
	at app//com.seatgeek.testing.snapshot.paparazzi.PaparazzisKt$sgSnapshot$1.invoke(Paparazzis.kt:18)
	at app//com.seatgeek.testing.snapshot.paparazzi.PaparazzisKt$sgSnapshot$1.invoke(Paparazzis.kt:17)
	at app//androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
	at app//androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
	at app//androidx.compose.ui.platform.ComposeView.Content(ComposeView.android.kt:428)
	at app//androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:252)
	at app//androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:251)
	at app//androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
	at app//androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
	at app//androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
	at app//androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:194)
	at app//androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:123)
	at app//androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:122)
	at app//androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
	at app//androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
	at app//androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
	at app//androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:114)
	at app//androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(Wrapper.android.kt:156)
	at app//androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(Wrapper.android.kt:155)
	at app//androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
	at app//androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
	at app//androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
	at app//androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:155)
	at app//androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:140)
	at app//androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
	at app//androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
	at app//androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:78)
	at app//androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3373)
	at app//androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3363)
	at app//androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:341)
	at app//androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source)
	at app//androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3363)
	at app//androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3298)
	at app//androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:587)
	at app//androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:966)
	at app//androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:519)
	at app//androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:140)
	at app//androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)
	at app//androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:1099)
	at app//androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:131)
	at app//androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:181)
	at app//androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.kt:314)
	at app//androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.kt:192)
	at app//androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:138)
	at app//androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)
	at app//androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:1174)
	at app//android.view.View.dispatchAttachedToWindow(View.java:21291)
	at app//android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3491)
	at app//android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3498)
	at app//android.view.ViewGroup.addViewInner(ViewGroup.java:5291)
	at app//android.view.ViewGroup.addView(ViewGroup.java:5077)
	at app//android.view.ViewGroup.addView(ViewGroup.java:5017)
	at app//android.view.ViewGroup.addView(ViewGroup.java:4989)
	at app//app.cash.paparazzi.Paparazzi.takeSnapshots(Paparazzi.kt:303)
	at app//app.cash.paparazzi.Paparazzi.snapshot(Paparazzi.kt:200)
	at app//app.cash.paparazzi.Paparazzi.snapshot$default(Paparazzi.kt:199)
	at app//app.cash.paparazzi.Paparazzi.snapshot(Paparazzi.kt:195)
	at app//app.cash.paparazzi.Paparazzi.snapshot$default(Paparazzi.kt:191)
	at app//com.seatgeek.testing.snapshot.paparazzi.PaparazzisKt.sgSnapshot(Paparazzis.kt:17)
	at app//com.seatgeek.android.checkout.CheckoutSnapshotTestsKt.checkoutSnapshot(CheckoutSnapshotTests.kt:674)
	at app//com.seatgeek.android.checkout.CheckoutSnapshotTests.checkoutAcknowledgements(CheckoutSnapshotTests.kt:91)

@jrodbx
Copy link
Collaborator

jrodbx commented Sep 23, 2023

@jacobtabak by latest version, do you mean the snapshot (since OP is referring to 1.3.1)?

@jrodbx
Copy link
Collaborator

jrodbx commented Sep 23, 2023

@juckrit: if so to the above ^, would you mind trying the latest snapshot and verifying the problem is now fixed?

@FergusK
Copy link

FergusK commented Sep 26, 2023

Hi @jrodbx,

I'm facing a similar issue to @juckrit
Have an example of it here https://github.com/FergusK/snapshot-test-module-poc with two modules

AGP: 8.1
Paparazzi plugin: 1.3.2-SNAPSHOT

@juckrit
Copy link
Author

juckrit commented Sep 27, 2023

@juckrit: if so to the above ^, would you mind trying the latest snapshot and verifying the problem is now fixed?

I tried with paparazzi version 1.3.1.
It's not working

@juckrit
Copy link
Author

juckrit commented Sep 27, 2023

@juckrit: if so to the above ^, would you mind trying the latest snapshot and verifying the problem is now fixed?

Ok. I already update my project to use version "1.3.2-SNAPSHOT" but it's still not working

@tiny0Xy9
Copy link

I'm also experiencing a similar problem.
Here is the environment.

パパラッチ バージョン: 1.3.1 および 1.3.2-SNAPSHOT
OS:Mac OS 13.5
SDKのコンパイル: 33
グラドルバージョン: 8.0
Android Gradle プラグイン バージョン: 8.1.0

The module configuration is the same as below.
android/nowinandroid#101

🙏

@douglasmarques
Copy link

Facing the same issue, is there any workaround so far?

@linean
Copy link

linean commented Dec 8, 2023

Same issue on my end 😢
paparazzi: 1.3.1
agp: 8.0.2
gradle: 8.1.1

@jrodbx jrodbx added this to the 1.3.3 milestone Jan 13, 2024
@jrodbx jrodbx self-assigned this Jan 14, 2024
@jrodbx jrodbx removed their assignment Jan 22, 2024
@kevinzheng-ap
Copy link
Collaborator

@jrodbx I can investigate this one this week if you have not planned to

@jrodbx
Copy link
Collaborator

jrodbx commented Jan 22, 2024

@jrodbx I can investigate this one this week if you have not planned to

Please do. Thanks.

@jrodbx jrodbx modified the milestones: 1.3.3, 1.3.4 Feb 20, 2024
@jrodbx jrodbx changed the title Resources$NotFoundException. If call resource (that res file is in app module) from dynamic feature module Resources$NotFoundException. If accessing app module resource from dynamic feature module Feb 21, 2024
@jrodbx jrodbx changed the title Resources$NotFoundException. If accessing app module resource from dynamic feature module Resources$NotFoundException when accessing app module resource from dynamic feature module Feb 21, 2024
@myakici
Copy link

myakici commented Mar 22, 2024

Any updates on fixing this bug. Thanks.

@iArtuc
Copy link

iArtuc commented Apr 15, 2024

have the same problem any news on this?

@MedetZhakupov
Copy link

I see that issue has been going on for a while now. Can we proceed with the new release 1.3.4 @jrodbx?

@jrodbx jrodbx modified the milestones: 1.3.4, 1.3.5 May 23, 2024
@kevinzheng-ap
Copy link
Collaborator

kevinzheng-ap commented Jun 7, 2024

The root cause of issue is that resources and assets artifacts are not published in application module, leading dynamic feature modules unable to consume them. After extensive investigation, it's evident that the proper resolution lies within AGP. A bug has been filed here, and I've been urging for its escalation. Hopefully, it will be addressed promptly, allowing us to integrate the new AGP into Paparazzi thereafter.

cc @jrodbx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests