googlesamples / mlkit

A collection of sample apps to demonstrate how to use Google's ML Kit APIs on Android and iOS
Apache License 2.0
3.59k stars 2.93k forks source link

MLKVisionImage import not found in KMP shared-iosMain #868

Closed yuvaraj119 closed 2 months ago

yuvaraj119 commented 2 months ago

Describe the bug MLKVisionImage import not found in KMP ios Added below code

`cocoapods { // Required properties // Specify the required Pod version here. Otherwise, the Gradle project version is used. version = "1.0" summary = "Some description for a Kotlin/Native module" homepage = "Link to a Kotlin/Native module homepage"

    // Optional properties
    // Configure the Pod name here instead of changing the Gradle project name
    name = "MyCocoaPod"
    ios.deploymentTarget = "12.0"

    framework {
        // Required properties
        // Framework name configuration. Use this property instead of deprecated 'frameworkName'
        baseName = "MyFramework"

        // Optional properties
        // Specify the framework linking type. It's dynamic by default.
        isStatic = false
        // Dependency export

// export(project(":anotherKMMModule")) @OptIn(ExperimentalKotlinGradlePluginApi::class) transitiveExport = false // This is default. }

    // Maps custom Xcode configuration to NativeBuildType
    xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
    xcodeConfigurationToNativeBuildType["CUSTOM_RELEASE"] = NativeBuildType.RELEASE

    pod("GoogleMLKit/BarcodeScanning") {
        moduleName = "MLKitBarcodeScanning"
        version = "6.0.0"
    }
    pod("GoogleMLKit/TextRecognition") {
        moduleName = "MLKitTextRecognition"
        version = "6.0.0"
    }
}`

this generates and links the MLKitBarcodeScanning and MLKitTextRecognition. I'm able to access these imports import cocoapods.GoogleMLKit.MLKTextRecognizer import cocoapods.GoogleMLKit.MLKBarcode and other related. But i'm not able to access the MLKVisionImage which also part of MLKTextRecognizer as per the official doc.

To Reproduce Example Steps to reproduce the behavior in sample app:

  1. Add the above cocoa pods to KMP project
  2. Sync the project
  3. try to import the MLKVisionImage
  4. should show error import not found

Expected behavior import cocoapods.GoogleMLKit.MLKVisionImage should be available when MLKTextRecognizer pod is added.

SDK Info:

Smartphone:

Development Environment:

yuvaraj119 commented 2 months ago

Finally found need to add pod("GoogleMLKit/Vision") { moduleName = "MLKitVision" version = "6.0.0" }