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

Build failure (ios) when trying to use purchases-kmp:ui #275

Open
7 of 10 tasks
AdrianLeeElder opened this issue Dec 9, 2024 · 11 comments
Open
7 of 10 tasks

Build failure (ios) when trying to use purchases-kmp:ui #275

AdrianLeeElder opened this issue Dec 9, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@AdrianLeeElder
Copy link

AdrianLeeElder commented Dec 9, 2024

Describe the bug
Currently, can't get past the compile phase on iOS when trying to use the UI assets. This is probably an installation issue, because from what I see, the official docs are vague for the Paywall implementations.

I'm using Cocoapods, this is my configuration:

pod("PurchasesHybridCommonUI") {
    version = libs.versions.purchases.common.get()
    extraOpts += listOf("-compiler-option", "-fmodules")
}

I'm not sure if I should include both PurchasesHybridCommonUI and PurchasesHybridCommon?

Gradle coordinates:

purchases-common = "13.12.0"
purchases-kmp = "1.3.3+13.12.0"
# Should both of these be included?
purchases-core = { module = "com.revenuecat.purchases:purchases-kmp-core", version.ref = "purchases-kmp" }
purchases-ui = { module = "com.revenuecat.purchases:purchases-kmp-ui", version.ref = "purchases-kmp" }
synthetic/ios/Pods/RevenueCatUI/RevenueCatUI/Resources/icons.xcassets: error: None of the input catalogs contained a matching stickers icon set or app icon set named  "AppIcon".
...
The following build commands failed:
 	CompileAssetCatalog /Users/aelder/Projects/bandapella/composeApp/build/cocoapods/synthetic/ios/build/Debug-iphoneos/RevenueCatUI/RevenueCat_RevenueCatUI.bundle /Users/aelder/Projects/bandapella/composeApp/build/cocoapods/synthetic/ios/Pods/RevenueCatUI/RevenueCatUI/Resources/icons.xcassets (in target 'RevenueCatUI-RevenueCat_RevenueCatUI' from project 'Pods')
 	Building project Pods with scheme PurchasesHybridCommonUI and configuration Debug
 (2 failures)
  1. Environment
    1. Platform: iOS
    2. SDK version:
    3. OS version: Mac 14.5
    4. IDE (e.g. Android Studio, Xcode, Fleet): Android Studio
    5. IDE version: 2024.2.1
    6. Device and/or emulator/simulator:
      • Device
      • Emulator/simulator
    7. Environment:
      • Closed testing / Sandbox
      • TestFlight
      • Production
    8. 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
Add any other context about the problem here.

@AdrianLeeElder AdrianLeeElder added the bug Something isn't working label Dec 9, 2024
@JayShortway
Copy link
Member

Hi, thanks for reporting this! A few questions to try to get to the bottom of this:

  • Just double checking: are you using CocoaPods to integrate your own Kotlin Multiplatform code with your iOS app as well?
  • Are you able to build your iOS app in Xcode? If you do, is the error the same, or different?
  • It seems related to an icon file and possibly the Info.plist file. Would be good to double check those. There are some people with a similar issue in this thread (although that's MAUI instead of KMP).

@Stuart-campbell
Copy link

Hi I am having the same issue, tried adding what was suggested on that other issue with no luck. My background is mainly Android so it could be something silly.

Here is a snipped of my build gradle incase its something obvious.

plugins {
    alias(libs.plugins.kotlinMultiplatform)
    alias(libs.plugins.compose)
    alias(libs.plugins.compose.compiler)
    alias(libs.plugins.android.library)
    alias(libs.plugins.cocoapods)
}

kotlin {

    androidTarget {
        publishLibraryVariants("release")
    }

    iosX64()
    iosArm64()
    iosSimulatorArm64()

    applyDefaultHierarchyTemplate()

    cocoapods {
        version = "1.0"
        ios.deploymentTarget = "16.0"
        podfile = project.file("../iosApp/Podfile")
        framework {
            baseName = "shared"
            isStatic = true
        }

        pod("PurchasesHybridCommon") {
            version = libs.versions.revenuecatVersion.get() 
            extraOpts += listOf("-compiler-option", "-fmodules")
        }

        pod("PurchasesHybridCommonUI") {
            version = libs.versions.revenuecatVersion.get()
            extraOpts += listOf("-compiler-option", "-fmodules")
        }
                
    }

    sourceSets {
        commonMain.dependencies {
            api(libs.revenuecat)
            api(libs.revenuecat.ui)
        }
    }
}

@AdrianLeeElder
Copy link
Author

Part of the solution is to remove the PurchasesHybridCommonUI/PurchasesHybridCommon pods from build.gradle.kts. This is because it's already declared in the other Gradle dependencies and it seems to be causing conflicts. May have to do a Gradle clean as well, I don't remember the exact sequence that cleared it up.

@Stuart-campbell
Copy link

If I don't include the pods I get a linker error.

I have put together a demo project that shows the error, signs do point to something in the RenvenueCat UI pod as I have had no issues with any of the firebase pods.

RevenueCatTest.zip

@AdrianLeeElder
Copy link
Author

AdrianLeeElder commented Dec 21, 2024 via email

@Stuart-campbell
Copy link

Stuart-campbell commented Dec 22, 2024

Tested again this morning and that test project is now building, digging further its the combanation of firebase pods and revenue cat that causes this issue. What I can't get my head around its its not a specific firebase library that breaks it instead its having multiple ones.

        pod("FirebaseMessaging") {
            version = libs.versions.firebasepodsVersion.get()
        }

        pod("FirebaseAnalytics") {
            version = libs.versions.firebasepodsVersion.get()
        }

        pod("FirebaseRemoteConfig") {
            version = libs.versions.firebasepodsVersion.get()
        }

        pod("PurchasesHybridCommon") {
            version = libs.versions.revenuecatVersion.get()
            extraOpts += listOf("-compiler-option", "-fmodules")
        }

        pod("PurchasesHybridCommonUI") {
            version = libs.versions.revenuecatVersion.get()
            extraOpts += listOf("-compiler-option", "-fmodules")
        }

This doesn't build but commenting out any of the firebase libs fixes it and it doesn't seem to matter which one. Not conviced at this point its not just something messed up my local machine.

RevenueCatTest.zip

@JayShortway
Copy link
Member

@Stuart-campbell What do you have defined as libs.versions.revenuecatVersion? Also, could you share the exact error you're getting? Thanks in advance!

@Stuart-campbell
Copy link

Stuart-campbell commented Dec 23, 2024

@JayShortway thanks for your reply. Full sample project is attached above in that zip so you can test yourself to verify its not just my mac.

Versions are ->

revenuecatVersion = "13.3.0"
purchases-kmp = "1.1.0+13.3.0"

Error from Android studio but the same happens directly in xcode ->

  The following build commands failed:
  	CompileAssetCatalog .../RevenueCatTest\ 2/shared/build/cocoapods/synthetic/ios/build/Release-iphonesimulator/RevenueCatUI/RevenueCat_RevenueCatUI.bundle .../RevenueCatTest\ 2/shared/build/cocoapods/synthetic/ios/Pods/RevenueCatUI/RevenueCatUI/Resources/icons.xcassets (in target 'RevenueCatUI-RevenueCat_RevenueCatUI' from project 'Pods')
  (1 failure)

Thanks

@JayShortway
Copy link
Member

@Stuart-campbell Thanks for providing that info. I can reproduce the issue with your test project. I'm not sure what's going on yet, still investigating. As a workaround for now, you might try removing the PurchasesHybridCommon[UI] pod dependencies from your build.gradle.kts, and adding them to Xcode using SPM.

Some more questions to get the full picture:

  • What is your Xcode version?
  • What is your JVM version?
  • Could you try with the latest version of purchases-kmp, 1.3.6+13.13.1? That helps ruling out any previously-fixed issues.

@JayShortway
Copy link
Member

JayShortway commented Dec 24, 2024

@Stuart-campbell Okay so here are the results of the investigation done together with @MarkVillacampa.

We found that this case is unique to the scenario where the Kotlin Multiplatform ("shared") module is integrated via CocoaPods. In this scenario, shared is a pod itself, which becomes an aggregate target, with all pod dependencies as subtargets. This causes CocoaPods to define the ASSETCATALOG_COMPILER_APPICON_NAME setting for the shared target. Then, the pod dependencies are built in a Run Script build phase. Since Run Script phases inherit the target's environment, the ASSETCATALOG_COMPILER_APPICON_NAME is defined, which results in an --app-icon argument being added to CompileAssetCatalog. This then fails, because the app icon is not defined in the asset catalog of the pod dependency.

You can safely delete the ASSETCATALOG_COMPILER_APPICON_NAME setting from your shared target in Xcode, but CocoaPods will add it back. So it's probably better to declare this post_install script in your Podfile file to ensure it stays gone:

target 'iosApp' do
  use_frameworks!
  platform :ios, '16.0'
  pod 'shared', :path => '../shared', :platforms => :ios

  # Add the following post_install script:
  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == 'shared'
        target.build_configurations.each do |config|
          config.build_settings.delete('ASSETCATALOG_COMPILER_APPICON_NAME')
        end
      end
    end
  end
end

We'll be updating our (recently open-sourced) public documentation as well. Let me know if you have any more questions.

Thanks a lot for reporting and providing the reproducer project! 🙏

@Stuart-campbell
Copy link

That works thanks a lot for your help.

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