Errors when trying to build iOS with cordova in Mavericks (10.9.1) - ios

Days ago I built the application for Android, zero problems, but now, when I try to do the same for iOS (obviously not the same commands) I always receive an error.
I use the following command:
cordova platform add ios
And I get the following error:
Downloading cordova library for ios...
Download complete
Creating ios project...
Error: An error occured during creation of ios sub-project.
File "/Users/xxxxx/.cordova/lib/ios/cordova/3.3.0/bin/update_cordova_subproject", line 31
print __doc__
^
SyntaxError: invalid syntax
at /usr/local/lib/node_modules/cordova/src/platform.js:282:30
at ChildProcess.exithandler (child_process.js:641:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
I tried also with:
phonegap build ios
But I get the same error and I don't know how to fix it. I've been looking on the Internet and I found some guy with the same problem but nobody could help him.
I run the commands with sudo, that isn't the problem.

I recently got the same error.
My problem was that I'm using Python3 by default. print in Python2 is a statement wherease in Python3 it's a function.
.cordova/lib/ios/cordova/3.3.0/bin/update_cordova_subproject has a shebang that calls /bin/python.
I had to replace #!/bin/python with #!/bin/python2.7 to use python2.7 on this script.

I have the exactly same problem with you. However, the way replace "#!/bin/python with #!/bin/python2.7" doesn't work for me.
Inspired by the explanation of Matthieu Riegler, I change print __doc__ to print(__doc__) in line 31 and print line to print(line) in line 97. Eventually, it works.

Related

How do I add flutter_local_notifications to my app?

I wanna add notification in my app with flutter_local_notifications but once I add the plugin to my .yaml, my app doesn't run again.
Below is the error
```D8: Program type already present: android.support.v4.app.INotificationSideChannel
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/2.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/3.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/6.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/7.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/8.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/9.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/10.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/11.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/12.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/13.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/14.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/15.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/16.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/17.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/18.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/19.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/20.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/21.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/22.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/23.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/24.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/25.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/26.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/27.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/28.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/29.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/30.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/31.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/32.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/33.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/34.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/35.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/36.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/37.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/38.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/39.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/40.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/41.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/42.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/43.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/44.jar, /Users/macbook/AndroidStudioProjects/restaurant/build/app/intermediates/transforms/dexBuilder/debug/45.jar
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel
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 29s
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See ... for more information on the problem and how to fix it.
Finished with error: Gradle task assembleDebug failed with exit code 1```
Thanks.
First you need to upgrade all the packages that you have to the version where they are compatible with AndroidX. You can know that from the ChangeLog.md of each package on the dart packages page. Next you need to open the android project of your flutter in AndroidStudio, then select Refactor->Migrate to AndroidX. Wait a bit until android studio refactors your project. And the run rebuild project from android studio. It should work then!

iso - FirebaseCrash - upload-sym error

Unexpected argument '/Users/saylanc/yazario-ios-app/Pods/ServiceAccount.json'
usage: /Users/saylanc/yazario-ios-app/Pods/FirebaseCrash/upload-sym [-h] [-v] [-w|-e]
Command /bin/sh failed with exit code 2
I am getting this error, I followed the guide at the official firebase page.
My bash script :
GOOGLE_APP_ID=1:xxxxx:ios:xxxx
"${PODS_ROOT}"/FirebaseCrash/upload-sym "${PODS_ROOT}"/ServiceAccount.json
Make sure you're using the latest version of FirebaseCrash. It looks like you have an older version of upload-sym.
Our app wasn't crashing, but we were getting the following warning."Unable to find service account JSON file: ${SERVICE_ACCOUNT FILE}"
What fixed it for us was to change the script to:
"${PODS_ROOT}"/FirebaseCrash/upload-sym "${SRCROOT}"/ServiceAccount.json
Thought that might help.

React native build to device failed

I'm trying to build to an iOS device, building to simulator works fine.
This is what I get:
uncaught error Error: TypeError: unsupported file type at lookup (/Users/NAME/git/vex/vex-app react/VexAppReact/node_modules/image-size/lib/index.js:35:9)
at /Users/NAME/git/vex/vex-app-react/VexAppReact/node_modules/image-size/lib/index.js:93:22
at /Users/NAME/git/vex/vex-app-react/VexAppReact/node_modules/image-size/lib/index.js:50:9
at /Users/NAME/git/vex/vex-app-react/VexAppReact/node_modules/graceful-fs/graceful-fs.js:43:10
at FSReqWrap.oncomplete (fs.js:82:15)
See logs /var/folders/h8/42h3w_qd2r9fvpwy99jsnjq40000gn/T/react-packager.log
at SocketClient._handleMessage (SocketClient.js:144:23)
at BunserBuf. (SocketClient.js:53:42)
at emitOne (events.js:90:13)
at BunserBuf.emit (events.js:182:7)
at BunserBuf.process (/Users/NAME/git/vex/vex-app-react/VexAppReact/node_modules/bser/index.js:289:10)
at /Users/NAME/git/vex/vex-app react/VexAppReact/node_modules/bser/index.js:244:12
at nextTickCallbackWith0Args (node.js:452:9)
at process._tickCallback (node.js:381:13)
Command /bin/sh failed with exit code 1
I'm assuming there's something wrong with image assets. I didn't install the image-size node module myself, so I doubt there's something wrong with that module, it could be though.
Any suggestions welcome.
Solution: apparently you can't add png files to native ios build

Ionic emulate ios: Session could not be started

I'm trying to emulate my application on ios but nothig works for me. I've been searching for two days about the error and all workarounds i've found doesn't work for me. I'm running OSX Yosemite, Xcode 6.1.1, Cordova 4.2.0, Ionic 1.3.8, Ios-Sim 3.1.1. This is the ouput:
** BUILD SUCCEEDED **
2015-03-01 20:07:08.576 ios-sim[5970:3191481] stderrPath: /path/to/myapp/platforms/ios/cordova/console.log
2015-03-01 20:07:08.577 ios-sim[5970:3191481] stdoutPath: /path/to/myapp/platforms/ios/cordova/console.log
Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Simulator session timed out." UserInfo=0x7ff3d370ff10 {NSLocalizedDescription=Simulator session timed out.}
Error: /path/to/myapp/platforms/ios/cordova/run: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)
I really don't know what to do. I already tried all worarounds I've found on internet: change files permissions, running as sudo, reset settings of emulator, open xcode before emulating my app, reinstalling cordova, etc, etc. No one works. Hope you can help me, guys! If you need further information, please let me know.
Thank you in advance!
I changed the permissions on directories it was using the whoami command
This seemed to work for me:
sudo chown -R $(whoami) ~/Documents/yourdirectory

integrate scandit barcode scanner plugin for cordova app in iOS

i am trying to integrate the Scandit Barcode scannner plugin to my cordova based application for iOS platform, but am unable to accomplish that. i have tried the following steps:
1) downloaded the SDK for Phonegap/Cordova and extracted it to a folder.
2) using the Cordova CLI, i executed the following command:
cordova plugin add <path to the folder>
i get the following error when i run that:
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
Error: Parsing /Users/macuser/Desktop/AppBackup/miniOrangeAuthenticator/platforms/ios/miniOrange Authenticator/config.xml failed:
ENOENT, no such file or directory '/Users/macuser/Desktop/AppBackup/ProjectName/platforms/ios/miniOrange Authenticator/config.xml'
at Object.config_parser (/usr/local/lib/node_modules/cordova/src/config_parser.js:28:15)
at Object.ios_parser (/usr/local/lib/node_modules/cordova/src/metadata/ios_parser.js:62:19)
at /usr/local/lib/node_modules/cordova/src/plugin.js:98:46
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:760:13)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:821:14
at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
at Function.Module.runMain (module.js:499:11)
macmans-MacBook-Air:ProjectName macuser$
what may be the reason? is there any other way i canaccomplish it (without CLI) ?
Change miniOrange Authenticator to miniOrangeAuthenticator. I don't think the CLI is a big fan of spaces (I have had problems in the past with them).

Resources