RevenueCat / purchases-android

Android in-app purchases and subscriptions made easy.
https://www.revenuecat.com/
MIT License
235 stars 45 forks source link

Android PaywallView not found for Java #1683

Closed paulocoutinhox closed 2 months ago

paulocoutinhox commented 3 months ago

Describe the bug A clear and concise description of what the bug is. The more detail you can provide the faster our team will be able to triage and resolve the issue. 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.

  1. Environment
    1. Platform: android
    2. SDK version: 7.9.0
    3. OS version: android14
    4. Android Studio version: 2023.1.1
    5. How widespread is the issue. Percentage of devices affected.
  2. Debug logs that reproduce the issue
  3. Steps to reproduce, with a description of expected vs. actual behavior
  4. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Additional context

Im trying use "com.revenuecat.purchases.ui.revenuecatui.views.PaywallView" from this file in my game:

https://github.com/RevenueCat/purchases-android/blob/main/examples/paywall-tester/src/main/res/layout/activity_paywall_view.xml

But it is not available and only get error when build:

/Users/paulo/Developer/workspaces/cpp/biblemania/proj.android/app/src/org/axmol/ui/PaywallDialog.java:37: error: cannot access AbstractComposeView
        binding.paywallView.setOfferingId(offeringID);
                           ^
  class file for androidx.compose.ui.platform.AbstractComposeView not found
/Users/paulo/Developer/workspaces/cpp/biblemania/proj.android/app/build/generated/data_binding_base_class_source_out/debug/out/com/biblemania/app/databinding/FragmentPaywallDialogBinding.java:59: error: incompatible types: inference variable T has incompatible upper bounds PaywallView,View
      PaywallView paywallView = ViewBindings.findChildViewById(rootView, id);
                                                              ^
  where T is a type-variable:
    T extends View declared in method <T>findChildViewById(View,int)
2 errors

I'm using Java, and not Kotlin.

My dependencies:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':libaxmol')
    implementation 'androidx.appcompat:appcompat:1.6.1'

    // revenue cat
    implementation 'com.revenuecat.purchases:purchases:7.9.0'
    implementation 'com.revenuecat.purchases:purchases-ui:7.9.0'

    // compose
    def composeBom = platform('androidx.compose:compose-bom:2024.04.01')
    implementation composeBom
    implementation 'androidx.compose.foundation:foundation'
    implementation 'androidx.compose.ui:ui'
    implementation 'androidx.activity:activity-compose:1.8.2'
}

And inside XML i get the error too:

image
RCGitBot commented 3 months ago

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

vegaro commented 2 months ago

sorry we haven't replied here yet.

Can you please try adding this dependency and confirm it compiles?

        implementation 'androidx.compose.ui:ui-android:1.5.4'

Thanks

paulocoutinhox commented 2 months ago

Hi, yes. After add android ui libraries it works.

github-actions[bot] commented 2 months ago

This issue has been automatically locked due to no recent activity after it was closed. Please open a new issue for related reports.