3

I'm working on a Compose Multiplatform app and I'm trying to integrate Google MLKit Barcode Scanner on the iOS side using CocoaPods.

However, when building the project, I get this error:

Failed to generate cinterop for :composeApp:cinteropGoogleMLKitIosArm64: 
Process 'command '/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java'' finished with non-zero exit value 1
composeApp:iosArm64Main: cinterop file: /Users/OTB/Desktop/Tkl/composeApp/build/libs/composeApp-iosArm64Cinterop-GoogleMLKitMain.klib does not exist
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html 

Here is my podfile, build.gradle and everything:

platform :ios, '15.5'

target 'iosApp' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
    pod 'composeApp', :path => '../composeApp'
    pod 'GoogleMLKit/BarcodeScanning', '8.0.0'

  # Pods for iosApp

end
cocoapods {
        summary = "Tkl ios dependency"
        homepage = "tkl.com/homepage"
        version = "1.0"
        podfile = project.file("../iosApp/Podfile")
        ios.deploymentTarget = "15.5"
 
        pod("GoogleMLKit/BarcodeScanning"){
            moduleName ="MLKitBarcodeScanning"
            version = "8.0.0"
            extraOpts += listOf("-compiler-option","-fmodules")
        }
 
    }
 
    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach { iosTarget ->
        iosTarget.binaries.framework {
            baseName = "ComposeApp"
            isStatic = true
        }
 
    }
sourceSets {
 
        androidMain.dependencies {
            implementation(compose.preview)
            implementation(libs.androidx.activity.compose)
            ...

        }
        commonMain.dependencies {
            implementation(compose.runtime)
            implementation(compose.foundation)
            ...
          
        }
        iosMain.dependencies {
            implementation(libs.ktor.client.darwin)
        }}

How can I correctly integrate Google MLKit Barcode Scanning pod into a Compose Multiplatform project for iOS, using CocoaPods?

Any help or working example would be highly appreciated!

1
  • did you find a solution? Commented Jun 1 at 14:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.