[英]Cordova CLI "cordova build android" error "Does not appear to be an xcode project, no xcode project file in..."?
我正在嘗試從我的 Windows 機器本地編譯我的 Cordova 應用程序。 我一直能夠做到這一點,直到我假期后回來,現在當我運行 cli“cordova build android”時,我得到了回應:
Does not appear to be an Xcode project, no Xcode project file in....
Xcode 與構建 Android 應用程序有什么關系? 我在技術上為兩者編譯,但我在 Mac 上運行 iOS 應用程序(運行良好)。
有誰知道發生了什么?
對我來說,刪除並重新添加 android 平台將允許我構建或運行該項目一次,但隨后在任何后續構建或運行嘗試中,問題都會再次出現。
我確定 Android 文件platforms/android/app/src/main/res/xml/config.xml
在構建階段被覆蓋為空/默認版本,這是有道理的,因為從調試日志中它似乎是此步驟后失敗:
從 /Users/groot/Projects/software-verde/litter-quality-propane/platforms/android/app/src/main/res/xml/config.xml 的 android 默認值生成特定於平台的 config.xml
最終這讓我意識到問題是從我的主 config.xml 中提取信息,而正是我之前為 iOS 添加的這些行導致了問題:
<config-file parent="NSPhotoLibraryUsageDescription" platform="ios" target="*-Info.plist">
<string>This app would like to access your photo library.</string>
</config-file>
<config-file parent="NSLocationAlwaysUsageDescription" platform="ios" target="*-Info.plist">
<string>This app would like to access your location, even when the app is not in use.</string>
</config-file>
<config-file parent="NSLocationWhenInUseUsageDescription" platform="ios" target="*-Info.plist">
<string>This app would like to access your location while the app is in use.</string>
</config-file>
由於這些配置文件更改僅與 iOS 相關,因此解決方案是將其包裝在平台標記中:
<platform name="ios">
[...]
</platform>
我猜這可能會發生在其他類似 iOS 特定但未明確包裝在平台標簽中的標簽上。 Cordova 似乎仍在嘗試對 Android 版本進行這些更改,但顯然無法做到,因為它不是 iOS 項目。
我不得不再次刪除 android 平台並嘗試刪除(不存在的)ios platofmr。 然后我重新添加了平台並且它構建正確。 但是當我運行“cordova emulate android”時,我仍然收到錯誤消息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.