Nativescript ios build fails with Error 65 - nativescript

I've run into an issue where suddenly my ios build will no longer build. It seems to have happened out of no-where.
I get this error and can't seem to get rid of it regardless of what I try.
[19-01-15 10:57:43.888] Build failed. Command xcodebuild failed with exit code 65 Error output:
** ARCHIVE FAILED **
I've tried tns platform remove ios
I've updated my plugins.
I also get these cli warnings before it fails:
(CLI) 1) Target 'class2tns' has copy command from ...
and
(CLI) warning: duplicate output file
for a number of files.
My Android version builds ok.

I had the same exit code from Xcode (65) and the warning of duplicate output file.
After along time of research the following steps are required because an update of a nativescript npm package.
rm -Rf platform/ios
rm -Rf node_modules
rm package-lock.json
pod repo update # important to execute this command in the project dir
tns build ios

Related

React Native - Xcode - DerivedData - Pods - ExpoModules

How exactly does xcode or xcode pods get cached?
I've made changes to update react native, or every time I make expo changes, or certain packages. My project is not an expo project but I am using the expo SDK.
Expo 44-45, React Native 67.3 trying to update to 68.5
My pod install command installs all the wrong dependencies.
I get CompileC --> DerivedData or iPhone Deployment Target errors or Simulator cached issues.
I delete derived data and everything, still pod installs all the wrong pods.
I know the cause of the errors, but I'm not sure why if I run npm i and pod install it installs all of a previous cached pods.
Now I'm getting:
Error: Command failed: xcrun simctl list --json devices
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
at checkExecSyncError (node:child_process:885:11)
at Object.execFileSync (node:child_process:921:15)
at runOnSimulator (/Users/me/repos/MobileApp/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:167:54)
at Object.runIOS [as func] (/Users/me/repos/MobileApp/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:121:12)
at Command.handleAction (/Users/me/repos/MobileApp/node_modules/#react-native-community/cli/build/index.js:192:23)
at Command.listener (/Users/me/repos/MobileApp/node_modules/commander/index.js:315:8)
at Command.emit (node:events:513:28)
at Command.parseArgs (/Users/me/repos/MobileApp/node_modules/commander/index.js:651:12)
at Command.parse (/Users/me/repos/MobileApp/node_modules/commander/index.js:474:21)```
Remove pod folder and podfile.lock file in iOS folder.
run this command pod install

Unable to locate adb on macOS Catalina

I am starting to learn how to do mobile programming with ReactNative on an android environment. I’m using MacOS Catalina and I’ve installed android studio and react-native-cli. I ran react-native init ShoppingList which passed
Downloading template,
Copying template,
Processing template
but failed at Installing CocoaPods dependencies because I wasn't at the latest OS yet(I hope this is not part of the problem because I don’t have enough memory to upgrade OS)
I’ve referred to a suggestion inside this issue, which asks me to run
npm uninstall -g react-native react-native-cli
npm install -g react-native react-native-cli
react-native start --reset-cache
I’ve also deleted the node_modules and npm install at the root of the project. Then at the root of the project I ran react-native run-android.
Which gave me the following error
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
/bin/sh: adb: command not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:installDebug'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/prashin/Test/ShoppingList/android/local.properties'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Inside Android Studio, the following are installed
Android 11.0(R),
Android SDK Build-Tools,
Android Emulator 30.2.6,
Android SDK-Platform-Tools 30.0.5,
Intel x86 Emulator Accelerator (HAXM installer) 7.5.1
I created a Pixel 2 Device with Release name R(API Level 30), and pressed the Play button countless times, it gives me the error of AVD Manager: Unable to locate ADB.
This is my .bash_profile file.
source ~/.profile
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
##
# Your previous /Users/prashin/.bash_profile file was backed up as /Users/prashin/.bash_profile.macports-saved_2019-10-23_at_18:32:04
##
# MacPorts Installer addition on 2019-10-23_at_18:32:04: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
export ANDROID_HOME=/Users/prashin/Library/Android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
export PATH="$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"
# export PATH="$PATH:/Users/$USER/Library/Android/sdk/platform-tools"
# export PATH=${PATH}:/usr/local/mysql-5.7.31-macos10.14-x86_64/bin
# Finished adapting your PATH environment variable for use with MacPorts.
And I do see an adb executable inside platform-tools according to this post.
What could I be missing here which is preventing me from running my basic application on the simulator? Do inform me if more information is needed.
Edit
A suggested solution of switching to .zprofile changed the error message instead. It got stuck at info launching emulator for 30s before producing the error below.
error Failed to launch emulator. Reason: Could not start emulator within 30 seconds..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
> Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
> Task :app:installDebug FAILED
Skipping device 'emulator-5554' (emulator-5554): Device is OFFLINE.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
27 actionable tasks: 2 executed, 25 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No online devices found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
With Catalina, Apple has changed the default shell to zsh. Therefore you have to rename your configuration files. .bashrc is now .zshrc and .bash_profile is now .zprofile. Move the contents of your .bash_profile to a new .zprofile file and restart your terminal. Run the app again with new environment variables in place.
Simply restarting the terminal made the trick for me...

Unable to run the flutter code getting error

Unable to run the flutter code getting error
Failed to capture snapshot of input files for task
'javaPreCompileDebug' property 'compileClasspaths' during up-to-date
check. > Error snapshotting jar [flutter.jar]
Finished with error: Gradle build failed: 1
Try
git clean -xfd
git pull
flutter doctor
in your Flutter install directory to fix your Flutter installation.

I am trying to make an apk its generated but with this error Execution failed for task ':app:bundleReleaseJsAndAssets'

Task :app:bundleReleaseJsAndAssets
Scanning folders for symlinks in C:\react-native\first_app\node_modules (109ms)
Scanning folders for symlinks in C:\react-native\first_app\node_modules (47ms)
warning: the transform cache was reset.
Loading dependency graph, done.
Unable to resolve module AccessibilityInfo from C:\react-native\first_app\node_modules\react-native\Libraries\react-native\react-native-implementation.js: Module AccessibilityInfo does not exist in the Haste module map
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: watchman watch-del-all.
2. Delete the node_modules folder: rm -rf node_modules && npm install.
3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache. 4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
Process 'command 'cmd'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 42s
12 actionable tasks: 1 executed, 11 up-to-date
As mentioned here, It may be because of you did not bundled correctly for android.
You can add following script
"bundle-android": "node node_modules/react-native/local-cli/cli.js bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/"
into scripts of your package.json
and the run npm run bundle-android
after that try running gradlew assembleRelease -x bundleReleaseJsAndAssets in android directory of your project. Hope it will solve your problem.

Xamarin iOS Framework Binding

I am trying to create a binding for the WePay Framework:
https://github.com/wepay/wepay-ios
Following are the steps that I followed.
I installed CocoaPods.
I installed ObjectiveSharpie
I run this command in terminal : $ sharpie pod init ios WePay
And I get this error: Could not install CocoaPod
here is the full error message:
** Setting up CocoaPods master repo ...
(this may take a while the first time)
Setting up CocoaPods master repo
$ /usr/bin/git pull --ff-only
From https://github.com/CocoaPods/Specs
ee36ba4..8c6767d master -> origin/master
Updating ee36ba4..8c6767d
Fast-forward
Specs/BluetoothKit/0.3.0/BluetoothKit.podspec.json | 35 ++++++++++++++++++++++
1 file changed, 35 insertions(+)
create mode 100644 Specs/BluetoothKit/0.3.0/BluetoothKit.podspec.json
Setup completed
** Searching for requested CocoaPods ...
** Working directory:
** - Writing Podfile ...
** - Installing CocoaPods ...
** (running pod install --no-integrate --no-repo-update)
[!] Unknown option: --no-integrate
Did you mean: --no-ansi?
Usage:
$ pod install
Downloads all dependencies defined in `Podfile` and creates an Xcode Pods
library project in `./Pods`.
The Xcode project file should be specified in your `Podfile` like this:
project 'path/to/XcodeProject.xcodeproj'
If no project is specified, then a search for an Xcode project will be
made. If more than one Xcode project is found, the command will raise an
error.
This will configure the project to reference the Pods static library, add
a build configuration file, and add a post build script to copy Pod
resources.
Options:
--repo-update Force running `pod repo update` before
install
--project-directory=/project/dir/ The path to the root of the project
directory
--silent Show nothing
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command
error: could not install CocoaPod
Well apparently the most recent CocoaPods removed the --no-integrate option that objective sharpie uses. Downgrading cocoapods to 0.39.0 should fix your issue. It worked for us.

Resources