I’m using Android Studio to test my Flutter app on a Mac. XCode is installed, and I got the IOS Simulator working from there. Android Studio can see the IOS device. I point XCode to the IOS folder in my project but when I run the app it fails saying Info.plist does not contain a valid CFBundleVersion.
When I try to open the Info.plist file in XCode, I get the error “Failed to open property list: Malformed data byte group at line 1; invalid hex”
Could the problem possibly be that I wrote the code on Windows, and downloaded it from Git to my Mac so the character formatting is different?
Find the plist.info file contents below.
Android Studio version: Giraffe (2022.3.1)
XCode version: 15
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Gm Firebase</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>gm_firebase</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>es</string>
</array>
</plist>
Here is the build error:
Xcode build done. 41.7s
Unable to install /Users/test/StudioProjects/gm_firebase/build/ios/iphonesimulator/Runner.app on 17A66106-BEA8-4F34-A75B-FE17E43E82A2. This is sometimes caused by a malformed plist file:
ProcessException: Process exited abnormally:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Simulator device returned an error for the requested operation.
The application’s Info.plist does not contain a valid CFBundleVersion.
Ensure your bundle contains a valid CFBundleVersion.
Underlying error (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The application’s Info.plist does not contain a valid CFBundleVersion.
Command: /usr/bin/arch -arm64e xcrun simctl install 17A66106-BEA8-4F34-A75B-FE17E43E82A2 /Users/test/StudioProjects/gm_firebase/build/ios/iphonesimulator/Runner.app
Error launching application on iPhone 15.
I’m not sure if it’s related, but the Flutter/Debug.xcconfig and Flutter/Release.xcconfig files also seem to have a format problem. I see this when I try to commit the files to Git:
2
Answers
I saved the plist file off as .txt and then renamed it back and it got past the problem where XCode didn’t like the file starting at the first character.
Then it complained that the plist could only contain one item, so I moved the CBBundleLocalizations key and values up into the dict section.
I can now successfully run iOS simulator throught Android Studio.
Now to figure out how to close out my own Question here...
Please check that if you have specified version in your pubspec.yaml which looks something like this "1.0.0+1" before + will specify that it is build_name and after + it specifies that it is build_number.