Ionic emulate ios - Error - angularjs

I'm getting this following error after I ran my app on my own ios device.
No target specified for emulator. Deploying to iPhone-6 simulator
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
ENOENT, no such file or directory '/Users/cauealmeida/Library/Logs/CoreSimulator/5C6DA43E-3993-4260-87EE-73FEB27DE181/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/cauealmeida/Documents/jobs/dev/ionic-maptest/map-test/platforms/ios/build/emulator/map-test.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/cauealmeida/Documents/jobs/dev/ionic-maptest/map-test/platforms/ios/cordova/console.log,--stdout,/Users/cauealmeida/Documents/jobs/dev/ionic-maptest/map-test/platforms/ios/cordova/console.log,--exit
Error: /Users/cauealmeida/Documents/jobs/dev/ionic-maptest/map-test/platforms/ios/cordova/run: Command failed with exit code 2
I've tried with ionic emulate ios -cls from different projects and the same error is shown.
What am I missing?

Here are the steps you can use to correct this issue:
1) Empty the 'platforms' folder in your Ionic project
2) Re-run ionic platform add ios, ionic build ios, and ionic emulate ios without sudo
3) Still getting a permissions error, make sure all the files in your user's home folder actually belong to that user by running
sudo chown -R username /Users/username

We fixed this using the SO answer here, which was just to Reset Content and Settings in the Simulator menu.

You need to download ios simulator.
Go to xcode and download ios 9 or other simulator.
you also need to install ios-sim using your terminal.
sudo npm install -g ios-sim
also check and confirmed your device is connected properly.
connected device you see in xcode window

Related

React Native 0.60 connection to development server

(I'm almost a newbie in React Native development) today I have started a new project in React Native 0.60 (react-native init MyApp).
After that I typed : react-native run-android to check if everything worked.
After the bundle process is finished
I can finally get my welcome screen in my connected devices
But, if I try to reload the app from my devices I get this error:
How could I address this error ?
EDIT: Thank you for your answers, anyway, I have tried all solutions you suggest but I still get the same problem. I also noticed that when i run react-native run-android Metro Bundler (open in a new cli window) seems to start but it suddenly disappear. I think the problem could be with the message 'Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0'
react-native run-android not working in new react-native version
0.60
now you can use
react-native start
OR
npm start
both command is work
Please use the following two commands and then can start the react native again.
- adb reverse tcp:8081 tcp:8081
- killall node
Then you can run the following the command.
react-native start
Now you can run your application again.
Have a good day.
You need to connect your phone to the server, follow the below steps:
[For detailed help follow this https://facebook.github.io/react-native/docs/running-on-device]
1. Open the developer menu on phone.
2. Open 'Debug server host & port for device'.
3. Type in your machine's IP address and the port of the local dev server (eg. 10.0.1.1:8081). If you have connected over wifi then this will be your computers ip address. (If you are running in your computer I think instead of ip address it would be 'localhost:8081')
4. Go back to the Dev menu and select reload.
Hope it would help.
You need to run adb reverse in the Android Studio terminal so your device can connect to the server. Open Android Studio and click on the terminal button at the bottom. In the terminal, and with your device connected to your computer, enter the command adb devices. This will list the name of the connected Android device. Copy that name. Then enter this command adb -s <device name> reverse tcp:8081 tcp:8081. When you run that command replace <device name> with the name of your device you copied from the other command.
Here is a link to an explanation in the React Native documentation

Error: Command failed: platform-tools/adb -s DEVICEID shell getprop

I'm using Ionic 4, Cordova 9, Nodejs 10.16, npm 6.9 and I would like to run the app on my device.
I just reinstalled Android Studio to the latest version and I got an error when using the run command:
Command
ionic cordova run android --device
Error (DEVICEID - My Device ID)
Error: Command failed: P:\Simplifiedpath\platform-tools/adb -s DEVICEID shell getprop
When using --verbose, I get those details:
ionic:lib:shell Error in subprocess stdout pipe: Error [ERR_STREAM_WRITE_AFTER_END]: write after end at writeAfterEnd (_stream_writable.js:248:12) at Object.Writable.write (_stream_writable.js:296:5) at Readable.write (C:\Simplifiedpath\npm\node_modules\ionic\node_modules\stream-combiner2\node_modules\readable-stream\lib\_stream_readable.js:85
What's the point about this error ?
after update sdk/platform-tools to version 29, i have the same error, to resolve:
Open Android Studio, and go to File>Settings>Android SDK on tab "SDK Tools" and uncheck
"Android SDK Platform-Tools 29" and click "Apply" to uninstall platform-tools
Then. download platform-tools 28 from this link
https://dl.google.com/android/repository/platform-tools_r28.0.0-windows.zip
uncompress "platform-tools" under sdk directory, for example: "C:\Users\User\AppData\Local\Android\sdk"
to check if good, see File>Settings>Android SDK on tab "SDK Tools", now look like the image

Unable to run the first time react-native app for android on mac

I'm trying to run the react-native application on the macbook for android version.So I have followed all the step for setting up the environment on the machine from here :
https://facebook.github.io/react-native/docs/getting-started.html
And I have successfully install Android Studio,Android SDK, JDK, Node, NPM, Watchman, Homebrew
javac -version : 9
node -v : v8.9.1
npm -v: 5.5.1
watchman version: 4.9.0
When I tried to run the application with the command
react-native run-android
I got this error :
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gradle.internal.reflect.JavaMethod (file:/Users/aman/.gradle/wrapper/dists/gradle-2.14.1-all/8bnwg5hd3w55iofp58khbp6yv/gradle-2.14.1/lib/gradle-base-services-2.14.1.jar) to method java.lang.ClassLoader.getPackages()
WARNING: Please consider reporting this to the maintainers of org.gradle.internal.reflect.JavaMethod
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> javax/xml/bind/annotation/XmlSchema
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 9.925 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
According to this GitHub issue, this issue has to do with JDK version. Make sure you're using v8, not v9, then the error should not occur.
Yes, according to #Sam Hanley it's an issue with the java version update. So, with worrying about the version update/downgrade, we can pass on with this issue by the following process;
First, update the distributionUrl in gradle-wrapper.properties
ie: located in this path;
PROJECT_PATH/android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-rc-2-all.zip
Set $JAVA_HOME environment variable using the installed android studio app path (Android studio should be installed)
export JAVA_HOME="/Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home"
(PS: solution for macOS )
Hope this help!
I was able to get past this particular problem by doing the following:
Edit path_to_your_project/android/gradlew
Change DEFAULT_JVM_OPTS="" to DEFAULT_JVM_OPTS="--add-modules java.se.ee"

Could not get BatchedBridge, make sure your bundle is packaged correctly happened on Android v4.4.2

I compiled react-native on Android v4.4.2 but the problems arised:
I tried to follow this solution, but I did not how to run on Command Prompt Windows 10:
$> cd myproject
$> react-native start > /dev/null 2>&1 &
$> curl "http://localhost:8081/index.android.bundle?platform=android" -o
> "android/app/src/main/assets/index.android.bundle
$> (cd android/ && ./gradlew assembleDebug)
I tried to compile the same way on Android V6.0. Then there was no problem at all.
How to make android V4.4.2 also can be use like Android v6.0 for my first react-native
project development?
That error means your React Native app can't fetch your JS files from your localhost. You'd usually just run react-native start to serve the JS files from your packager, but Android 4.4.x cannot connect to your localhost with the default adb reverse method.
The way I run on Android 4.4.x is to manually set the device to connect to my machine via Wi-Fi (Official guide here!).
Access the React Native dev menu by shaking your device or pressing the hardware menu button (can be done with Ctrl+M or Cmd+M in a simulator, IIRC)
Go to Dev Settings
Under the Debugging section, tap "Debug server host & port for device"
Enter your machine's IP address, as well as the port through which the React Native packager is serving, e.g. "10.0.0.25:8081" (make sure your device and your machine are on the same network!)
Reload through the dev menu again (or by pressing Ctrl+R or Cmd+R in a simulator, I think)
Try running this command
adb reverse tcp:8081 tcp:8081

ionic build fails error 65

Building my ionic app fails since this weekend:
** BUILD FAILED **
The following build commands failed:
CompileC build/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/IonicKeyboard.o App/Plugins/com.ionic.keyboard/IonicKeyboard.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/me/Documents/app/platforms/ios/cordova/build-debug.xcconfig,-project,app.xcodeproj,ARCHS=i386,-target,app,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/me/Documents/app/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/me/Documents/app/platforms/ios/build/sharedpch
OSX 10.11.3
XCode 7.2.1 (7C1002)
ionic -v
1.7.14
Today I reinstalled cordova and ionic, but I still keep getting the error. I had to adjust another issue with macports (here), which I fixed by setting the rights right, but still keep getting the above error.
Error 65 seems to have originate from within Cordova plugins. I've been able to "band-aid" this issue by:
cordova plugin remove <plugin name>
ionic platform remove <os>
ionic platform add <os>
cordova plugin add <plugin name>
I've also tried using sudo while running these commands with mixed results.
I fixed with following steps
in xCode go-to "Build Phase" >> Under "Compile Sources" >>
did you notice any missing or .m files failed to link... in my case it was "IonicKeyboard.m" file
I just added the file to the list "plugins/cordova-plugin-ionic-keyboard/src/ios/IonicKeyboard.m"
then Build Project - worked
iOS
Open platforms/ios on XCode
Find & Replace io.ionic.starter in all files for a unique identifier
Click the project to open settings
Signing > Select a team
Go to your device Settings > General > DeviceManagement
Trust your account/team
ionic cordova run ios --device --livereload

Resources