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

XmlPullParserException: getNamespacePrefix() not supported #1245

Closed
7 of 11 tasks
bharel opened this issue Jan 19, 2025 · 17 comments
Closed
7 of 11 tasks

XmlPullParserException: getNamespacePrefix() not supported #1245

bharel opened this issue Jan 19, 2025 · 17 comments
Labels
bug Something isn't working

Comments

@bharel
Copy link

bharel commented Jan 19, 2025

‼️ Required data ‼️

Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.

There are a lot of things that can contribute to things not working. Having a very basic understanding of your environment will help us understand your issue faster!

Environment

  • Output of flutter doctor
  • Version of purchases-flutter
  • Testing device version e.g.: iOS 15.5, Android API 30, etc.
  • How often the issue occurs- every one of your customers is impacted? Only in dev?
  • Debug logs that reproduce the issue
  • Steps to reproduce, with a description of expected vs. actual behavior

Flutter doctor

[✓] Flutter (Channel stable, 3.27.2, on macOS 14.5 23F79 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.95.2)
[✓] VS Code (version 1.97.0-insider)
[✓] Connected device (2 available)
[✓] Network resources

Package versions

purchases_flutter 8.4.1
purchases_ui_flutter 8.4.1

Device

Android 13, model: Redfin 64-bit Only (pixel 5?)

Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Stacktrace:

Caused by org.xmlpull.v1.XmlPullParserException: getNamespacePrefix() not supported
at android.content.res.XmlBlock$Parser.getNamespacePrefix(XmlBlock.java:142)
at androidx.compose.ui.graphics.vector.compat.XmlVectorParser_androidKt.seekToStartTag(XmlVectorParser_android.kt:1)
at androidx.compose.ui.res.PainterResources_androidKt.loadVectorResource(PainterResources_android.kt:1)
at androidx.compose.ui.res.PainterResources_androidKt.painterResource(PainterResources_android.kt:1)
at com.revenuecat.purchases.ui.revenuecatui.composables.PaywallIconKt.PaywallIcon-FNF3uiM(PaywallIcon.kt:1)
at com.revenuecat.purchases.ui.revenuecatui.templates.Template5Kt.Feature(Template5.kt:1)
at com.revenuecat.purchases.ui.revenuecatui.templates.Template5Kt.Features(Template5.kt:1)
at com.revenuecat.purchases.ui.revenuecatui.templates.Template5Kt.Template5PortraitContent(Template5.kt:1)
at com.revenuecat.purchases.ui.revenuecatui.templates.Template5Kt.Template5(Template5.kt:1)
at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt.TemplatePaywall(InternalPaywall.kt:1)
at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt.access$TemplatePaywall(InternalPaywall.kt:1)
at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt$LoadedPaywall$3$1.invoke(InternalPaywall.kt:2)
at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt$LoadedPaywall$3$1.invoke(InternalPaywall.kt:1)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:1)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambdaImpl.java:1)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:1)
at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt.LoadedPaywall(InternalPaywall.kt:1)
at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt.access$LoadedPaywall(InternalPaywall.kt:1)
at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt$InternalPaywall$2$2.invoke(InternalPaywall.kt:2)

Describe the bug

Happens infrequently upon trying to view the revenuecat purchase screen. As I see this error only through crashlytics I'm unable to further analyze it.

Additional context

@bharel bharel added the bug Something isn't working label Jan 19, 2025
@RCGitBot
Copy link
Contributor

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

@vegaro
Copy link
Contributor

vegaro commented Jan 20, 2025

Thank you for reporting, is this only happening on Pixel 5 Android 13, or does Crashlytics provide more information about the distribution? We are wondering if it's a particular paywall icon that's causing this issue on certain devices only

@bharel
Copy link
Author

bharel commented Jan 20, 2025

Brand:Google
Model:Pixel 5
Android 11

Brand:Google
Model:Pixel 6
Android 12

Brand:Google
Model:Redfin 64-bit Only
Android 13

Brand:Google
Model:Pixel 7
Android 13

Image

Do note my current beta testers mostly (only?) use pixels, I wouldn't assume straight out of the bat that it's a pixel issue. The distribution is larger than I previously assumed. Maybe it's a code issue on my end but even then I'd expect a more appropriate exception thrown.

@bharel
Copy link
Author

bharel commented Jan 27, 2025

It's becoming a really big problem, apparently none of my users are able to purchase.

@vegaro
Copy link
Contributor

vegaro commented Jan 27, 2025

Hey @bharel we looked into this a bit and didn't see anything concerning on our end. Are you able to reproduce it consistently? It looks like the exception occurs when loading the ✔ icon in your paywall's features section. If it's consistently failing, do you mind checking if another icon makes it crash? Just in case there's a particular issue with that icon (if it's corrupted) or if it's a general issue loading icons

@bharel
Copy link
Author

bharel commented Jan 27, 2025

@vegaro I'm able to reproduce consistently now. Switched to a different icon and it doesn't work. It worked before so I highly doubt its the tick icon.

@bharel
Copy link
Author

bharel commented Jan 27, 2025

Seems like it doesn't happen on debug mode, only on release. Managed to grab a full traceback:

E/AndroidRuntime(31430): FATAL EXCEPTION: main
E/AndroidRuntime(31430): Process: com.example.app, PID: 31430
E/AndroidRuntime(31430): java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
E/AndroidRuntime(31430): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:601)
E/AndroidRuntime(31430): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:891)
E/AndroidRuntime(31430): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime(31430): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(31430): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
E/AndroidRuntime(31430): 	... 1 more
E/AndroidRuntime(31430): Caused by: org.xmlpull.v1.XmlPullParserException: getNamespacePrefix() not supported
E/AndroidRuntime(31430): 	at android.content.res.XmlBlock$Parser.getNamespacePrefix(XmlBlock.java:179)
E/AndroidRuntime(31430): 	at v1.a.a(SourceFile:1)
E/AndroidRuntime(31430): 	at l2.c.b(SourceFile:1)
E/AndroidRuntime(31430): 	at l2.c.c(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.composables.PaywallIconKt.PaywallIcon-FNF3uiM(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.templates.Template5Kt.Feature(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.templates.Template5Kt.Features(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.templates.Template5Kt.Template5PortraitContent(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.templates.Template5Kt.Template5(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt.TemplatePaywall(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt.access$TemplatePaywall(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt$LoadedPaywall$3$1.invoke(SourceFile:2)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt$LoadedPaywall$3$1.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at d1.b.d(SourceFile:1)
E/AndroidRuntime(31430): 	at d1.b.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at v0.x.b(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt.LoadedPaywall(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt.access$LoadedPaywall(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt$InternalPaywall$2$2.invoke(SourceFile:2)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt$InternalPaywall$2$2.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at d1.b.b(SourceFile:1)
E/AndroidRuntime(31430): 	at d1.b.invoke(SourceFile:2)
E/AndroidRuntime(31430): 	at y.e.a(SourceFile:1)
E/AndroidRuntime(31430): 	at y.e.f(SourceFile:1)
E/AndroidRuntime(31430): 	at y.e.e(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt$InternalPaywall$2.invoke(SourceFile:2)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt$InternalPaywall$2.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at d1.b.d(SourceFile:1)
E/AndroidRuntime(31430): 	at d1.b.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.fonts.PaywallThemeKt.PaywallTheme(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt.InternalPaywall(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.PaywallKt.Paywall(SourceFile:1)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.activity.PaywallActivity$onCreate$1$1$1.invoke(SourceFile:2)
E/AndroidRuntime(31430): 	at com.revenuecat.purchases.ui.revenuecatui.activity.PaywallActivity$onCreate$1$1$1.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at d1.b.b(SourceFile:1)
E/AndroidRuntime(31430): 	at d1.b.invoke(SourceFile:2)
E/AndroidRuntime(31430): 	at r0.l0$d$b.invoke(SourceFile:2)
E/AndroidRuntime(31430): 	at r0.l0$d$b.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at d1.b.d(SourceFile:1)
E/AndroidRuntime(31430): 	at d1.b.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at e2.y$h.invoke(SourceFile:2)
E/AndroidRuntime(31430): 	at e2.y$h.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at d1.b.d(SourceFile:1)
E/AndroidRuntime(31430): 	at d1.b.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at v0.c.d(SourceFile:1)
E/AndroidRuntime(31430): 	at v0.n.p0(SourceFile:1)
E/AndroidRuntime(31430): 	at v0.n.i0(SourceFile:1)
E/AndroidRuntime(31430): 	at v0.t.j(SourceFile:1)
E/AndroidRuntime(31430): 	at v0.m2.a(SourceFile:1)
E/AndroidRuntime(31430): 	at v0.n$b.a(SourceFile:1)
E/AndroidRuntime(31430): 	at v0.t.C(SourceFile:1)
E/AndroidRuntime(31430): 	at v0.t.t(SourceFile:1)
E/AndroidRuntime(31430): 	at e2.y.N(SourceFile:1)
E/AndroidRuntime(31430): 	at e2.y.L(SourceFile:1)
E/AndroidRuntime(31430): 	at e2.y.M(SourceFile:1)
E/AndroidRuntime(31430): 	at e2.y.K(SourceFile:1)
E/AndroidRuntime(31430): 	at e2.y$c.Z0(SourceFile:1)
E/AndroidRuntime(31430): 	at r0.l0$d.a(SourceFile:1)
E/AndroidRuntime(31430): 	at r0.l0$d.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at e2.y$d.f(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.w.R(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0$d.invoke(SourceFile:2)
E/AndroidRuntime(31430): 	at g2.l0$d.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at f1.k$a.h(SourceFile:1)
E/AndroidRuntime(31430): 	at f1.u$a.h(SourceFile:1)
E/AndroidRuntime(31430): 	at f1.u.n(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l1.h(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l1.f(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0.U(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0.h(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0$b.L1(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0$b.R(SourceFile:1)
E/AndroidRuntime(31430): 	at e0.f.f(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.w.R(SourceFile:1)
E/AndroidRuntime(31430): 	at androidx.compose.ui.graphics.e.b(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.c0.R(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0$d.invoke(SourceFile:2)
E/AndroidRuntime(31430): 	at g2.l0$d.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at f1.k$a.h(SourceFile:1)
E/AndroidRuntime(31430): 	at f1.u$a.h(SourceFile:1)
E/AndroidRuntime(31430): 	at f1.u.n(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l1.h(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l1.f(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0.U(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0.h(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0$b.L1(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0$b.R(SourceFile:1)
E/AndroidRuntime(31430): 	at e2.u0.f(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.w.R(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0$d.invoke(SourceFile:2)
E/AndroidRuntime(31430): 	at g2.l0$d.invoke(SourceFile:1)
E/AndroidRuntime(31430): 	at f1.k$a.h(SourceFile:1)
E/AndroidRuntime(31430): 	at f1.u$a.h(SourceFile:1)
E/AndroidRuntime(31430): 	at f1.u.n(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l1.h(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l1.f(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0.U(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0.h(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.l0$b.L1(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.g0.i1(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.r0.f(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.r0.A(SourceFile:1)
E/AndroidRuntime(31430): 	at g2.r0.t(SourceFile:1)
E/AndroidRuntime(31430): 	at androidx.compose.ui.platform.f.onMeasure(Unknown Source:100)
E/AndroidRuntime(31430): 	at android.view.View.measure(View.java:28375)
E/AndroidRuntime(31430): 	at h2.a.internalOnMeasure$ui_release(SourceFile:1)
E/AndroidRuntime(31430): 	at h2.a.onMeasure(SourceFile:1)
E/AndroidRuntime(31430): 	at android.view.View.measure(View.java:28375)
E/AndroidRuntime(31430): 	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7025)
E/AndroidRuntime(31430): 	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
E/AndroidRuntime(31430): 	at android.view.View.measure(View.java:28375)
E/AndroidRuntime(31430): 	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7025)
E/AndroidRuntime(31430): 	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608)
E/AndroidRuntime(31430): 	at android.widget.LinearLayout.measureVertical(LinearLayout.java:878)
E/AndroidRuntime(31430): 	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
E/AndroidRuntime(31430): 	at android.view.View.measure(View.java:28375)
E/AndroidRuntime(31430): 	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7025)
E/AndroidRuntime(31430): 	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
E/AndroidRuntime(31430): 	at com.android.internal.policy.DecorView.onMeasure(DecorView.java:735)
E/AndroidRuntime(31430): 	at android.view.View.measure(View.java:28375)
E/AndroidRuntime(31430): 	at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:4905)
E/AndroidRuntime(31430): 	at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:3306)
E/AndroidRuntime(31430): 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3611)
E/AndroidRuntime(31430): 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2991)
E/AndroidRuntime(31430): 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10491)
E/AndroidRuntime(31430): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1566)
E/AndroidRuntime(31430): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1575)
E/AndroidRuntime(31430): 	at android.view.Choreographer.doCallbacks(Choreographer.java:1175)
E/AndroidRuntime(31430): 	at android.view.Choreographer.doFrame(Choreographer.java:1104)
E/AndroidRuntime(31430): 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1549)
E/AndroidRuntime(31430): 	at android.os.Handler.handleCallback(Handler.java:991)
E/AndroidRuntime(31430): 	at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(31430): 	at android.os.Looper.loopOnce(Looper.java:232)
E/AndroidRuntime(31430): 	at android.os.Looper.loop(Looper.java:317)
E/AndroidRuntime(31430): 	at android.app.ActivityThread.main(ActivityThread.java:8875)
E/AndroidRuntime(31430): 	... 3 more

flutter clean, dart pub upgrade -> purchases_flutter + purchases_ui_flutter @ 8.4.3, still happens.

@vegaro
Copy link
Contributor

vegaro commented Jan 27, 2025

Hmm that's actually very good information.

can you try setting shrinkresources to false and see if it fixes it on release mode?

I suspect the drawables might be getting removed

You can disable shrinkResources in your app/build.gradle

buildTypes {
    release {
        minifyEnabled true
        shrinkResources false

@bharel
Copy link
Author

bharel commented Jan 27, 2025

Doesn't work unfortunately, with and without =.

    buildTypes {
        release {
            signingConfig = signingConfigs.release
            minifyEnabled true  // Revenuecat bug
            shrinkResources false // Revenuecat bug
            ndk {
                debugSymbolLevel 'FULL'
            }
        }
    }

@vegaro
Copy link
Contributor

vegaro commented Jan 27, 2025

Can you also try setting both minifyEnabled false and shrinkResources false? I would expect this to be related to shrinkResources but maybe it's something to do with minify...

@bharel
Copy link
Author

bharel commented Jan 27, 2025

🎉 minification.

Works on release:

minifyEnabled false  // Revenuecat bug
shrinkResources false // Revenuecat bug

Now I need to know what to do as I obviously wish to ship minified and shrinked 😄

Awesome job helping me find it out, thanks!

@vegaro
Copy link
Contributor

vegaro commented Jan 27, 2025

That's great news. I think we need to add a keep.xml file to our plugin

In the meantime, to make sure that fixes it. Do you mind adding this file to android/src/main/res/raw in your project? And try reenabling both minifyEnabled and shrinkResources

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
    tools:keep="@drawable/warning,@drawable/add,@drawable/android,@drawable/apple,@drawable/attach_money,@drawable/attachment,@drawable/bar_chart,@drawable/bookmark,@drawable/bookmark_no_fill,@drawable/calendar_today,@drawable/chat_bubble,@drawable/check_circle,@drawable/close,@drawable/collapse,@drawable/compare,@drawable/download,@drawable/edit,@drawable/email,@drawable/error,@drawable/experiments,@drawable/extension,@drawable/file_copy,@drawable/filter_list,@drawable/folder,@drawable/globe,@drawable/help,@drawable/insert_drive_file,@drawable/launch,@drawable/layers,@drawable/line_chart,@drawable/lock,@drawable/notifications,@drawable/person,@drawable/phone,@drawable/play_circle,@drawable/remove_red_eye,@drawable/search,@drawable/share,@drawable/smartphone,@drawable/stacked_bar,@drawable/stars,@drawable/subtract,@drawable/tick,@drawable/transfer,@drawable/two_way_arrows,@drawable/vpn_key" />

If that works, we'll make a release with the file so it's automatically added to everyone

@bharel
Copy link
Author

bharel commented Jan 27, 2025

Does not work in android/app/src/main/res/raw/revenuecat_keep.xml nor in android/src/main/res/raw/revenuecat_keep.xml
Does not work as android/src/main/res/raw/revenuecat.keep.xml.
As android/app/src/main/res/raw/revenuecat.keep.xml throws the following error:

Launching lib/main.dart on Pixel 6 Pro in release mode...
ERROR: /project/android/app/src/main/res/raw/revenuecat.keep.xml: Resource and asset merger: '.' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore

FAILURE: Build failed with an exception.

File content:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
    tools:keep="@drawable/warning,@drawable/add,@drawable/android,@drawable/apple,@drawable/attach_money,@drawable/attachment,@drawable/bar_chart,@drawable/bookmark,@drawable/bookmark_no_fill,@drawable/calendar_today,@drawable/chat_bubble,@drawable/check_circle,@drawable/close,@drawable/collapse,@drawable/compare,@drawable/download,@drawable/edit,@drawable/email,@drawable/error,@drawable/experiments,@drawable/extension,@drawable/file_copy,@drawable/filter_list,@drawable/folder,@drawable/globe,@drawable/help,@drawable/insert_drive_file,@drawable/launch,@drawable/layers,@drawable/line_chart,@drawable/lock,@drawable/notifications,@drawable/person,@drawable/phone,@drawable/play_circle,@drawable/remove_red_eye,@drawable/search,@drawable/share,@drawable/smartphone,@drawable/stacked_bar,@drawable/stars,@drawable/subtract,@drawable/tick,@drawable/transfer,@drawable/two_way_arrows,@drawable/vpn_key" />

@bharel
Copy link
Author

bharel commented Jan 27, 2025

@vegaro if you wish to debug live I'm @bharel on the revenuecat discord. Maybe it'll help you tackle it faster :-)

@vegaro
Copy link
Contributor

vegaro commented Jan 28, 2025

I figured it out @bharel . It looks like it's actually related to the share_plus plugin. I managed to reproduce it in a barebones project with your dependencies (which includes share_plus), I was getting a different stacktrace, but I think that might depend on the Gradle version. This is what I was getting:

java.lang.IncompatibleClassChangeError: Class 'android.content.res.XmlBlock$Parser' does not implement interface 'i7.a' in call to 'int i7.a.next()'

You have two alternatives, adding this rule to your app/proguard-rules.pro:

-keep class org.xmlpull.v1.** { *; }

Don't forget to tell gradle to use that file:

buildTypes {
        release {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

Or fully disabling R8 full mode by adding the following into your gradle.properties:

android.enableR8.fullMode=false

I would be more inclined to use the first option, but I am not sure there would be a need to keep any other class (although that rule is already fairly aggressive). If you get other runtime issues around XML, that might be the reason.

Here is a related stripe issue flutter-stripe/flutter_stripe#1909.

As far as I understand, this comes enabled by default with AGP 8, and it’s fairly aggressive. It only happens when having share_plus plugin added to your project, so it is an issue on their Proguard config, which by the way it is inexistent. An issues for cross-reference here

The real fix would be that share_plus add a proguard file to their plugin so the right rules get correctly propragated to the apps.

@bharel
Copy link
Author

bharel commented Jan 28, 2025

That is so random. I'm sorry for the nuisance :-(
You're a saviour!
Testing...

@bharel
Copy link
Author

bharel commented Jan 28, 2025

Works like magic 🎉

Thanks so much!

Now on to the next one! Firebase bugs here we come! ❤🗡

@bharel bharel closed this as completed Jan 28, 2025
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

3 participants