You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FATAL EXCEPTION: main
Process: com.duckduckgo.mobile.android.debug, PID: 7644
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:226)
at android.content.res.Resources.getColor(Resources.java:1068)
at android.content.Context.getColor(Context.java:794)
at androidx.core.content.ContextCompat$Api23Impl.getColor(ContextCompat.java:1071)
at androidx.core.content.ContextCompat.getColor(ContextCompat.java:529)
at com.duckduckgo.app.notification.NotificationFactory.createNotification(NotificationFactory.kt:44)
at com.duckduckgo.app.dev.settings.notifications.NotificationViewModel$1.invokeSuspend(NotificationsViewModel.kt:96)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelled}@6b057af, Dispatchers.Main.immediate]
Thank you for opening an Issue in our Repository.
The issue has been forwarded to the team and we'll follow up as soon as we have time to investigate.
As stated in our Contribution Guidelines, requests for feedback should be addressed via the Feedback section in the Android app.
This issue arises because @ColorInt is being retrieved using ContextCompat.getColor(), which expects a @ColorRes reference rather than a resolved color integer.
In the ClearDataSpecification class, @ColorInt is already assigned using the following logic, ensuring that the value returned is a direct color integer. However, in the NotificationFactory class, the color is being accessed as if it were a @ColorRes, leading to an incorrect conversion attempt.
Instead of resolving the color again, the existing @ColorInt value can be used directly. The function below retrieves the resolved color integer from an attribute and can be utilized as needed:
@ColorInt
fun Context.getColorFromAttr(
@AttrRes attrColor:Int,
typedValue:TypedValue = TypedValue(),
resolveRefs:Boolean = true,
): Int {
theme.resolveAttribute(attrColor, typedValue, resolveRefs)
return typedValue.data
}
By using this approach, we can ensure that colors are correctly handled without redundant lookups or mismatches between @ColorInt and @ColorRes.
Describe the bug
Click this setting and the app crash.
How to Reproduce
--> Crash
Screen_recording_20250131_000517.online-video-cutter.com.mp4
Expected behavior
Is this behavior normal?
Environment
The text was updated successfully, but these errors were encountered: