问题描述
我想为Android Studio 4.1.2中的Kotlin Multiplatform Mobile应用程序的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.
如果我没记错的话,它曾经是开箱即用的.系统自动为Android 和 iOS配置了一个新的Kotlin Multiplatform Mobile项目.我不确定发生了什么变化.可能有一些更新.
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框架丢失
,请尝试生成使用终端的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 packForXcode
Now 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应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!