本文介绍了如何在 Android Studio 中为 Kotlin Multiplatform 配置 iOS 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为 Android Studio 4.1.2 中的 Kotlin 多平台移动应用程序的 iOS 应用程序添加运行/调试配置.不过iOS的配置好像有问题.

I want to add a Run/Debug Configuration for an iOS Application for a Kotlin Multiplatform Mobile application in Android Studio 4.1.2. However, there seems to be a problem with the configuration for iOS.

在下面的屏幕截图中,您可以看到问题.在对话框运行/调试配置"中Android Studio 抱怨

In the screenshot below you can see the problem. In the dialog "Run/Debug Configuration" Android Studio complains about

Error: Please specify Xcode project location in xcodeproj property of gradle.properties

使用修复"按钮不能解决问题.Android Studio 只是向 gradle.properties 添加了一个额外的 xcodeproj 并且抱怨重复参数.

Using the "Fix" button does not solve the problem. Android Studio just adds an additional xcodeproj to gradle.properties and the complains about a duplicate parameter.

我还为 xcodeproj 尝试了不同的路径(相对路径和绝对路径).没有运气.

I also tried different paths (relative and absolute) for xcodeproj. No luck.

如果我没记错的话,它曾经是开箱即用的.一个新的 Kotlin Multiplatform Mobile 项目已自动配置为 Android iOS.我不确定发生了什么变化.可能有些东西更新了.

If I remember correctly, it used to work out of the box. A new Kotlin Multiplatform Mobile project was automatically configured for Android and iOS. I'm not sure what changed. Probably something was updated.

这是 KMM 插件的错误吗?或者我可以在我的系统上做些什么来解决这个问题?

Is this a bug with the KMM plugin? Or is there something I can do on my system to fix this?

推荐答案

如果项目即使从 Xcode 打开它也没有立即运行并显示 shared framework is missing,然后尝试生成使用终端的iOS平台共享框架.导航到项目文件夹并执行
命令:./gradlew packForXcode现在共享框架应该有一个 xcode-frameworks 产品,您应该能够通过 Xcode 构建和运行项目.

If the project doesn't run right away even on opening it from Xcode and shows the shared framework is missing, Then try generating the shared framework for iOS platform using terminal. Navigate to the project folder and execute
Command: ./gradlew packForXcodeNow the shared framework should have a xcode-frameworks product and you should be able to build and run the project through Xcode.

这篇关于如何在 Android Studio 中为 Kotlin Multiplatform 配置 iOS 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 14:04