Reputation: 2364
I am trying to locally compile my Cordova app from my Windows machine. I have been able to do this fine until I came back after the holiday and now when I run the cli "cordova build android" I get the response:
Does not appear to be an Xcode project, no Xcode project file in....
What does Xcode have to do with building an Android app? I am technically compiling for both but I do the iOS app on a mac (which runs fine).
Does anyone know what has happened?
Upvotes: 1
Views: 506
Reputation: 1452
For me, removing and re-adding the android platform would allow me to build or run the project once but then on any subsequent build or run attempts the issue would appear again.
I determined that the Android file platforms/android/app/src/main/res/xml/config.xml
was getting overwritten during the build phase to an empty/default version of it, which made sense because from debug logging it appeared to be failing after this step:
Generating platform-specific config.xml from defaults for android at /Users/groot/Projects/software-verde/litter-quality-propane/platforms/android/app/src/main/res/xml/config.xml
Ultimately this led me to realize that the issue was pulling information in from my main config.xml and that it was these lines that I had previously added for iOS that were causing the problem:
<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>
Since these config file changes are only relevant to iOS, the solution was to wrap it in a platform tag:
<platform name="ios">
[...]
</platform>
I'm guessing this could happen with other tags like this that are iOS-specific but that are not explicitly wrapped in a platform tag. It seems that Cordova is still trying those changes to Android builds but then obviously isn't able to because it isn't an iOS project.
Upvotes: 1
Reputation: 2364
I had to remove the android platform again and try to remove a (none existing) ios platofmr. I then re-added the platform and it built correctly. But when I run "cordova emulate android" I still get the error.
Upvotes: 0