Flutter ios: I'm getting "(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core)", can't see why - xcode

I'm new to flutter and I've received a "working Android" project which I should adapt to iOS, at least I need it to make it boot and such.
After some reading here and there and then some additional googling I've come with a version of the flutter app that Xcode 13 can compile and launch on the simulator without any problem, but once it runs then some kind of initialization process fails with this error:
MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core)
I read the words of the message, I understand what they say but I don't understand what they mean.
I already did a flutter clean a flutter pub get then I went into the ios folder to do a pod install/update. Typically I delete Pods folder just in case (to have a even cleaner environment)...
The pubspec.yaml relevant lines I have are these:
name: xxxxxxxxxxxxxxxxxxxxxxx
description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
firebase_core: ^1.7.0
firebase_crashlytics: "^2.2.3"
airship_flutter: ^4.0.0
pull_to_refresh: 2.0.0
http: ^0.13.4
dev_dependencies:
flutter_test:
sdk: flutter
flutter_native_splash: ^0.2.8
flutter_native_splash:
image: assets/splash.png
android: true
ios: true
flutter:
uses-material-design: true
After doing pod install/update I also get this relevant info inside my Podfile.lock file:
Airship (14.4.2):
Airship/Automation (14.4.2):
Airship/Core (14.4.2)
Airship/ExtendedActions (14.4.2):
Airship/MessageCenter (14.4.2):
airship_flutter (4.4.0):
Firebase/CoreOnly (8.9.0):
Firebase/Crashlytics (8.9.0):
firebase_core (1.10.0):
firebase_crashlytics (2.3.0):
FirebaseCore (8.9.0):
FirebaseCoreDiagnostics (8.9.0):
FirebaseCrashlytics (8.9.0):
FirebaseInstallations (8.9.0):
Flutter (1.0.0)
GoogleDataTransport (9.1.2):
GoogleUtilities/Environment (7.6.0):
GoogleUtilities/Logger (7.6.0):
GoogleUtilities/UserDefaults (7.6.0):
nanopb (2.30908.0):
nanopb/decode (2.30908.0)
nanopb/encode (2.30908.0)
PromisesObjC (2.0.0)
airship_flutter (from `.symlinks/plugins/airship_flutter/ios`)
firebase_core (from `.symlinks/plugins/firebase_core/ios`)
firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`)
Flutter (from `Flutter`)
(I got this simplified version executing this command line: cat ios/Podfile.lock | grep " - " | grep "(" | grep -v " "
EDIT: I did some 'flutter pub upgrade' to raise my libraries versions a bit. The versions of the above list are the last ones I'm using.
EDIT: Here I add also some excerpt from my lib/main.dart file
...
import 'package:firebase_core/firebase_core.dart';
Future<void> main() async {
// This is for Firebase
WidgetsFlutterBinding.ensureInitialized();
HttpOverrides.global = PolarStarHttpOverrides();
// Launch app after splash
runApp(MyApp());
}
class MyApp extends StatelessWidget {
final Future<FirebaseApp> _fbApp = Firebase.initializeApp();
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: FutureBuilder(
future: _fbApp,
...
I'm not sure about what else to look for, Xcode builds ok, min SDK version is set to 11, the app builds, but it doesn't go beyond some ugly banner on screen claiming "Something went WORNG" (sic)
This error appears in some other people's Stack Overflow questions but for Android, and I'm using iOS. My coworker (using android) has no apparent problem whatsoever booting and running the flutter app.
I've read documentation here and there, but nothing has lead me to any relevant fix...
Is there some additional detail I might have overlooked?
EDIT: I've already tried many different cleaning approaches (as running "flutter clean" and some other similar commands for the "ios" subproject ) to no avail. I also tried some "flutter pub upgrade" (instead of 'get') in case some newer version libraries could appear (and some of them did, but to no avail again).

Add firebase_core :any in pubspec.yaml, delete PodFile.lock Run flutter clean then flutter pub get. Then navigate to ios folder in terminal. Run pod install. Now you should be able to run it successfully.

Remove podfile.lock,.symlinks, Pods
Now "flutter pub get" & install pods using "pod install"
after that just open XCode again..

Related

Flutter project failing to build on Mac M1

I have recently bought a new Mac book with the M1 chip and faced huge issues between Flutter and Firebase in building. I will list both the Flutter error log and Xcode error log.
Note: I'm building on Flutter channel Master
Flutter Error Log:
Launching lib/main.dart on iPod touch (7th generation) in debug mode...
Xcode build done. 69.1s
Failed to build iOS app
Error output from Xcode build:
objc[30795]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1fe91f8f0) and ?? (0x1189402b8). One of the two will be used. Which one is undefined.
objc[30795]: Class AMSupportURLSession is implemented in both ?? (0x1fe91f940) and ?? (0x118940308). One of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPlugin.m:141:20: warning: 'UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead [-Wdeprecated-declarations]
[[[UIAlertView alloc] initWithTitle:#"Error"
^
In module 'UIKit' imported from /Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/Target Support Files/image_picker/image_picker-prefix.pch:2:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAlertView.h:27:12: note: 'UIAlertView' has been explicitly marked deprecated here
#interface UIAlertView : UIView
^
1 warning generated.
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPhotoAssetUtil.m:17:44: warning: 'UIImagePickerControllerReferenceURL' is deprecated: first deprecated in iOS 11.0 - Will be removed in a future release, use PHPicker. [-Wdeprecated-declarations]
NSURL *referenceURL = [info objectForKey:UIImagePickerControllerReferenceURL];
^
In module 'UIKit' imported from /Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/Target Support Files/image_picker/image_picker-prefix.pch:2:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIImagePickerController.h:62:51: note: 'UIImagePickerControllerReferenceURL' has been explicitly marked deprecated here
UIKIT_EXTERN UIImagePickerControllerInfoKey const UIImagePickerControllerReferenceURL API_DEPRECATED("Will be removed in a future release, use PHPicker.", ios(4.1, 11.0)) API_UNAVAILABLE(tvos); // an NSURL that references an asset in the AssetsLibrary framework
^
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPhotoAssetUtil.m:21:47: warning: 'fetchAssetsWithALAssetURLs:options:' is deprecated: first deprecated in iOS 11 - Will be removed in a future release [-Wdeprecated-declarations]
PHFetchResult<PHAsset *> *result = [PHAsset fetchAssetsWithALAssetURLs:#[ referenceURL ]
^
In module 'Photos' imported from /Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPhotoAssetUtil.h:6:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Photos.framework/Headers/PHAsset.h:74:1: note: 'fetchAssetsWithALAssetURLs:options:' has been explicitly marked deprecated here
+ (PHFetchResult<PHAsset *> *)fetchAssetsWithALAssetURLs:(NSArray<NSURL *> *)assetURLs options:(nullable PHFetchOptions *)options API_DEPRECATED("Will be removed in a future release", ios(8, 11), tvos(8, 11)) API_UNAVAILABLE(macos);
^
2 warnings generated.
1 warning generated.
error: the following command failed with exit code 0 but produced no further output
CompileC /Users/wissamboughannam/Library/Developer/Xcode/DerivedData/Runner-awkucyxpawezvvfjchbivjxuwsah/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/file_picker.build/Objects-normal/x86_64/FilePickerPlugin.o /Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.4.2/ios/Classes/FilePickerPlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
/Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRLogger.m:58:28: warning: this old-style function definition is not preceded by a prototype [-Wstrict-prototypes]
void FIRLoggerInitializeASL() {
^
/Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRLogger.m:101:20: warning: this old-style function definition is not preceded by a prototype [-Wstrict-prototypes]
void FIRResetLogger() {
^
2 warnings generated.
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:259:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Users/wissamboughannam/Developer/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
? context.inheritFromWidgetOfExactType(type) as InheritedProvider<T>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:260:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Users/wissamboughannam/Developer/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
: context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
note: Removed stale file
As for the Error log from Xcode:
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:259:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Users/wissamboughannam/Developer/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
? context.inheritFromWidgetOfExactType(type) as InheritedProvider<T>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:260:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Users/wissamboughannam/Developer/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
: context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
This is the main error, there were many warning, but I'm not sure if they're causing the build failure.
Running flutter doctor result:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 2.1.0-11.0.pre.227, on macOS 11.1 20C69 darwin-arm, locale en-SA)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.54.1)
[✓] Connected device (2 available)
• No issues found!
As we know that m1 mac runs on arm based processor and thus few things like cocoa pods and ffi needs to be build based on that.
After a long research i came up with few steps which will definitely help everytime you stuck with xcode flutter application build for m1 mac.
To install completely cocoapods on Mac with M1 chip (Apple Silicon), please follow those steps:
Cocoa Pods Installation in M1
sudo gem install cocoapods
sudo gem install ffi
arch -x86_64 sudo gem install cocoapods -n /usr/local/bin
sudo gem install cocoapods -n /usr/local/bin
Install ffi
sudo arch -x86_64 gem install ffi
#update repo
arch -x86_64 pod install --repo-update
Flutter iOS builds
flutter clean
flutter build ios
Re-install dependency in iOS folder of flutter project
arch -x86_64 pod install
I also have an M1 Mac, and am on the stable channel, without any errors.
Try switching to stable first.
Also, try running $ flutter clean and again building the app.
I removed all depreciations and the project ran perfectly.
i had another issue related to flutter dependency that showing error OBJC_CLASS on firebase dependency, image cropper, stripe, etc.
My xcode disable archive & distribute menu because no successful build to archive.
I resolved it with this idea: build the app on terminal/android studio, then archive & distribute on xcode.
The step is:
uninstall cocoapods
sudo gem uninstall cocoapods
install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
nano ~/.zshrc
export PATH="/opt/homebrew/bin:$PATH"
brew --version
install cocoapods
brew install cocoapods
pod --version
link xcode
flutter doctor
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
go to your flutter project and
flutter clean
flutter pub get
cd ios
pod install
pod update
open Runner.xcworkspace with xcode and set your signing & capabilities
open terminal on your flutter project and build
flutter build ios --release
This will build Runner.app
Go to xcode, on Runner choose any ios device (arm64), to enable archive.
Then
product-> archive->distribute app->next->manual signin->set your certificate distributor
This will build your .ipa

I have a problem running the Flutter project

hi have this error when I tryng to run my Flutter application
I'm beginner using Flutter, thank to your help.
There are my dependencies in the YAML file.
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
generic_bloc_provider: ^1.0.8
firebase_auth:
google_sign_in:
firebase_storage: ^2.1.0
cloud_firestore: ^0.9.13
image_picker: ^0.5.4+3
cached_network_image: ^0.8.0
The problem is with cached_network_image: ^0.8.0
Try flutter clean in terminal window.
If the above does not solve the issue, then try removing cached_network_image: ^0.8.0 from pubspec.yaml and save pubspec.yaml. Run flutter pub get in terminal window Then add cached_network_image: ^0.8.0 back again and run flutter pub get in terminal window.
If the above does not solve the issue, then try to install a different version of the plugin, the current version is cached_network_image: ^2.3.3
I think the 3rd option should solve the issue. If not there is one more thing you can try.

Expo not loading (React-Native) -- null Expo SDK version

My app was working till today but now it looks like something happened to version 18 of Expo.
I got this error:
The experience you requested uses Expo SDK v(null), but this copy of
Expo Client requires at least v20.0.0. The author should update their
experience to a newer Expo SDK version.
I then:
Updated to Expo v20.0.0
Handled all unmet dependencies
yarn cache clean
rm -rf node_modules/
Reinstalled local node modules
and I'm still getting the same error.
What do I need to do to get Simulator to recognize that I am using the correct version of Expo?
Current environment:
Expo v20.0.0
react-native v0.47.0
Node v8.11.1
Xcode v9.3
Mac OS v10.13.4
Thanks to #PritishVaidya for helping me figure this out.
The problem was simply that I was missing "sdkVersion": "20.0.0" from my app.json. The use of this is lined out in the Expo Docs.
For example:
{
"expo": {
"name": "My app",
"slug": "my-app",
"sdkVersion": "20.0.0",
"privacy": "public"
}
}

main.jsbundle does not exist. this must be a bug with + echo 'react native

I tried to archive my react native project using Product > Archive on XCode9.2. But Xcode produce this error:
File /Users/louis/Library/Developer/Xcode/DerivedData/Scavenger-evyvzocndqoghkclcbwewolywniz/Build/Products/Release-iphoneos/Scavenger.app/main.jsbundle does not exist. This must be a bug with
My Environment:
OS: macOS Sierra 10.12.6
Node: 9.3.0
npm: 5.5.1
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: ^16.0.0 => 16.2.0
react-native: ^0.50.3 => 0.50.4
I also tried to run on terminal
react-native bundle --entry-file='index.ios.js' --bundle-output='./ios/Scavenger/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'but ended up with error Loading dependency graph...
Unexpected end of JSON input
XCode error.
This issue take me some days to fixed. I got this issue when run the build on travis-ci.
Here is my fix:
Add this line to scripts in your package.json file.
"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'"
Now your can run the command to generate main.jsbundle.
yarn build:ios or npm run build:ios
Open the Xcode > Select project target > add main.jsbundle to Copy Bundle Resource in Build Phases. (image below).
This happens when there is no offline bundle file in your project, I had the same problem and this worked for me.
I have added the below line to my package.json file, under scripts section, so I don't have to type it every time I want to generate an offline bundle.
"build:ios": "react-native bundle --entry-file='index.ios.js' --bundle-output='./ios/YourAppName/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'"
And then run this command in your application projects folder:
npm run build:ios
After running the above command, new main.jsbundle will be generated in your ios/YourAppName directory.
Next, open your project using XCode, right click on your project name then click Add Files to "YourProjectName", choose the main.jsbundle file that was generated, and then build again.
Now it might be working well.
I am using:
"react": "16.0.0-alpha.12",
"react-native": "^0.48.3",
Comment this line in AppDelegate.m
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil];
Use this line:-
jsCodeLocation = [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"];
After that run this to make jsbundle:-
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
Run after this command in xcode .
Hope it will make bundle and there is no such error after that ...
Thanx
if you update the xcode and get this error then solution is
in terminal of your root project fire following commands
1. sudo xcode-select --reset
2. npx react-native bundle --entry-file ./index.js --platform ios --bundle-output ios/main.jsbundle
during second command if you found any error relative to JS then fix it
After successfully running second command this error will be gone
I was facing this issue after I ejected from the expo to add in-app purchases.
I did the following to get it to work
cd <your repo>
npx react-native bundle --entry-file ./index.js --dev false --reset-cache --platform ios --bundle-output ios/main.jsbundle --assets-dest ./ios
After the above commands are run you have to drag and drop the main.jsbundle and the assets into your Xcode and link it by reference and not group
Recommend to use the latest Xcode and React Native versions.
My React Native Version: 0.56 and Xcode 10
Step 1: Change AppDelegate.m file
// jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil];
#ifdef DEBUG
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil];
#else
jsCodeLocation = [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"];
#endif
Step 2: Change Xcode Build Configuration to "Release"
Goto Products> Scheme> Edit Scheme> change Debug to release
if you are using Xcode 10+ please change Build system to Legacy Build System under File> ProjectWorkSpace Settings> Build System
Step 3: Upgrade your "babel-preset-react-native" to 5.0.1, if it does not exist in your package.json file please add it.
Remove NodeModules and package.lock file and add it (npm install or yarn install).
Step 4: Change ".babelrc.js" file
Add " presets: ["module:metro-react-native-babel-preset"]
Step 5: Open Terminal
Open the terminal and navigate to your project directory run this command
"react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios/assets"
this will generate a "main.jsbundle" file in iOS folder
Step 6: Add "main.jsbundle" file into Xcode.
Open Xcode and navigate to "Build Phase" under "Copy Bundle Resource" add "main.jsbundle" file.
Clean your project also clear your derived data in Xcode.
This will build your project in Release mode.
For "Archive" error
Add this dependency into your "pod file"
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'CxxBridge'
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
Remove pod and pod.lock and add again. (pod install)
Happy Coding :)
You need to run the following command:
react-native bundle --entry-file ./index.js --platform ios --bundle-output ios/main.jsbundle
After that, the app with the static bundle is installed on the real device. But because the nature of the static file, whenever I modify the source code, I need to run that command again to reflect the changes.
(You can see next error in command)
Problem solved after I rewrite shell script. Project > Build Phases > Bundle React Native code and images. There was blank space character in the script.
This commnad works for me.
react-native bundle --entry-file ./index.ios.js --platform ios --bundle-output ios/main.jsbundle
You can just run:
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
In my case I got this error at archive after updating from RN 0.53.3 to 0.55.4
/Users/<myuser>/Desktop/projects/<myProjectName>mobileapp/index.ios.js: Plugin 0 specified in "/Users/<myUserName>/Desktop/projects/<myProjectName>mobileapp/node_modules/babel-preset-react-native/index.js" provided an invalid property of "default" (While processing preset: "/Users/<myUserName>/Desktop/projects/<myProjectName>mobileapp/node_modules/babel-preset-react-native/index.js")
+ [[ false != true ]]
+ [[ ! -f /Users/<myUserName>/Library/Developer/Xcode/DerivedData/<myProjectName>Mobile-ghzbbftkebcwlvayfocqahvzifbe/Build/Intermediates.noindex/ArchiveIntermediates/<myProjectName>Mobile/BuildProductsPath/Release-iphoneos/<myProjectName>Mobile.app/main.jsbundle ]]
+ echo 'error: File /Users/<myUserName>/Library/Developer/Xcode/DerivedData/<myProjectName>Mobile-ghzbbftkebcwlvayfocqahvzifbe/Build/Intermediates.noindex/ArchiveIntermediates/<myProjectName>Mobile/BuildProductsPath/Release-iphoneos/<myProjectName>Mobile.app/main.jsbundle does not exist. This must be a bug with'
error: File /Users/<myUserName>/Library/Developer/Xcode/DerivedData/<myProjectName>Mobile-ghzbbftkebcwlvayfocqahvzifbe/Build/Intermediates.noindex/ArchiveIntermediates/<myProjectName>Mobile/BuildProductsPath/Release-iphoneos/<myProjectName>Mobile.app/main.jsbundle does not exist. This must be a bug with
+ echo 'React Native, please report it here: https://github.com/facebook/react-native/issues'
React Native, please report it here: https://github.com/facebook/react-native/issues
+ exit 2
A big importance to fix this had the line above the error related to babel-preset-react-native
After many hours of trying several workarounds I found a solution by downgrading babel-preset-react-native from ^5.0.2 to ^4.0.0 to make the archive process work.
In my case, it was caused by the javascript code. The error showed at the Metro Bundler(Command Line). Check the Metro Bundler, Does it have an Error or not.
For some people like me this is simply an indication of an error in the JavaScript code. I discovered this to be the case after entering the following command: npx react-native bundle --entry-file index.js --bundle-output "bundle.bundle". Android users would need to specify the platform like so: npx react-native bundle --entry-file --platform "ios" index.js --bundle-output "bundle.bundle".
The bundle failed and the syntax error was shown. Any attempt to open the offending code in a simulator would show the error too.
In my case this was caused by a space character in my project path: /users/USER/Projects/Project HousePlants/
That space in Project Houseplants the bundle can not handle and therefore can not find your main.jsbundle
Make sure that you have no whitespace characters in your path and try again.
See this answer
If properties of config file are changing at run time then make sure there is no error in that as well, if property is not set properly then main.bundlejs would not be generated.
For Example :
isSent:false,
isShow:false
this two properties were setting at run time and found that for a particular record isSent and isShow were not set which made it
isSent:,
isShow:
at run time and caused error.
PFB the command I ran, which resolves the issue.
npm i
cd ios
pod install
Please Make sure you are using same node version in project and xcode
For me i had installed 2 different nodejs versions. when delete one nodejs it was working fine
This is completely stupid, but it happened to me, so I will mention it in case it happens to someone else:
This error occurred on Product > Archive because of a missing dependency.
Changes to package.json were not pushed with the code using the newly added dependency. x)
True story. (facepalm)
Another instance:
import from a JavaScript file that wasn't pushed.
Simply cleaning the project in Xcode helped me

nativescript 'tns run android' throws ClassNotFoundException

I did a fresh clone of the nativescript grocery git repo, and checked out the angualr-start branch, did 'platform add android', and then 'tns run android' (which my android device connected)
The app came up and displayed this error: pastebin.com/1YbThGkZ
perhaps the most significant part of the error being this:
java.lang.ClassNotFoundException: Didn't find class "com.tns.FragmentClass" on path: DexPathList[[zip file "/data/app/org.nativescript.groceries-1/base.apk"],nativeLibraryDirectories=[/data/app/org.nativescript.groceries-1/lib/arm, /data/app/org.nativescript.groceries-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /systementer code here/lib]]
Solution: upgrade to native script (and tns-core-modules) v2.1
upgrade to native script (and tns-core-modules) v2.1
sudo npm install nativescript -g --unsafe-perm
tns plugin remove tns-core-modules
tns plugin add tns-core modules

Resources