diff --git a/packages/flutter_tools/lib/src/application_package.dart b/packages/flutter_tools/lib/src/application_package.dart index 2f838605cd..9091ef9c39 100644 --- a/packages/flutter_tools/lib/src/application_package.dart +++ b/packages/flutter_tools/lib/src/application_package.dart @@ -319,7 +319,7 @@ abstract class IOSApp extends ApplicationPackage { return null; } if (!project.exists) { - // If the project doesn't exist at all the existing hint to run flutter + // If the project doesn't exist at all the current hint to run flutter // create is accurate. return null; } @@ -327,6 +327,10 @@ abstract class IOSApp extends ApplicationPackage { printError('Expected ios/Runner.xcodeproj but this file is missing.'); return null; } + if (!project.xcodeProjectInfoFile.existsSync()) { + printError('Expected ios/Runner.xcodeproj/project.pbxproj but this file is missing.'); + return null; + } return BuildableIOSApp(project); } diff --git a/packages/flutter_tools/test/application_package_test.dart b/packages/flutter_tools/test/application_package_test.dart index 503701c747..54e94fc039 100644 --- a/packages/flutter_tools/test/application_package_test.dart +++ b/packages/flutter_tools/test/application_package_test.dart @@ -294,6 +294,15 @@ void main() { expect(iosApp, null); }, overrides: overrides); + + testUsingContext('returns null when there is no Runner.xcodeproj/project.pbxproj', () async { + fs.file('pubspec.yaml').createSync(); + fs.file('.packages').createSync(); + fs.file('ios/Runner.xcodeproj').createSync(recursive: true); + final BuildableIOSApp iosApp = IOSApp.fromIosProject((await FlutterProject.fromDirectory(fs.currentDirectory)).ios); + + expect(iosApp, null); + }, overrides: overrides); }); }