Ionic VS Code debugging issue: Unable to communicate with target - ionic-framework

I can no longer debug the Ionic application in Visual Code because of this error: "Unable to communicate with target". This issue only occurs on iOS device. Android works fine.
Web Inspector from Safari's Advance settings on device is enabled. I've also tried to reinstall ios-webkit-debug-proxy and ideviceinstaller and usbmuxd.
brew uninstall ios-webkit-debug-proxy
brew uninstall ideviceinstaller
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
brew install ios-webkit-debug-proxy
The configuration from launch.json is:
{
"name": "Attach to running iOS on device",
"type": "cordova",
"request": "attach",
"platform": "ios",
"target": "device",
"port": 9222,
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"attachAttempts": 5,
"attachDelay": 5000
}
ionic info
Ionic CLI : 5.1.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.1.10
Cordova:
Cordova CLI : 8.1.2 (cordova-lib#8.1.1)
Cordova Platforms : ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-webview 1.2.1, (and 22 other plugins)
Utility:
cordova-res : 0.3.0 (update available: 0.5.1)
native-run : 0.2.5 (update available: 0.2.7)
System:
ios-deploy : 1.9.4
NodeJS : v10.15.0 (/usr/local/bin/node)
npm : 6.9.0
OS : macOS High Sierra
Xcode : Xcode 10.1 Build version 10B61
I run ios-webkit-debug-proxy manually in terminal:
Listing devices on :9221
Connected :9222 to Test (b78b701f3f1cca9a1177271de27916f4fc53c00a)
And then I start debug process.
The error is:
Attaching to ios
Configuring debugging proxy
Unable to communicate with target

Related

Ionic and Ionic CLI [duplicate]

I wonder how to check the version of ionic. If I do ionic -v I get back 1.4.3
Can that be? Wasn't 1.0.0 just released?
Run from your project folder:
$ ionic info
Cordova CLI: 5.0.0
Ionic Version: 1.0.1
Ionic CLI Version: 1.6.1
Ionic App Lib Version: 0.3.3
OS: Windows 7 SP1
Node Version: v0.12.2
If your CLI is old enough, it will say "info is not a valid task" and you can use this:
$ ionic lib
Local Ionic version: 1.0.1 (C:\stuff\july21app\www\lib\ionic\version.json)
Latest Ionic version: 1.0.1 (released 2015-06-30)
* Local version up to date
That is the version number of the Ionic CLI, which is different from the version number of Ionic's library. Here are a couple easy ways to check the version.
In the browser console, you can run ionic.version and it will print to the console what version it is.
You can also look at the bower.json file in your app, and it will show the version number like you see here. https://github.com/ionic-in-action/chapter5/blob/master/bower.json#L5
In the terminal following command returns the version:
'ionic version' or 'ionic -v'
returned
'3.2.0'
The above is the CLI version. Go to the project folder and use the code below like scw's answer.
$ cd ionic-project
$ ionic info
✔ Gathering environment info - done!
Ionic:
ionic (Ionic CLI) : 4.2.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib#8.1.1)
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic 5.2.7, cordova-plugin-ionic-webview 2.2.5, (and 15 other plugins)
System:
NodeJS : v8.12.0 (/usr/local/bin/node)
npm : 6.4.1
OS : OS X Yosemite
$ ionic -v
CLI 4.12.0
you will be able to know your framework version
$ ionic info
all details
At some point in time the object changed from ionic to an uppercase Ionic.
As of July 2017 you need to put Ionic.version into your console to get the version number.
Ionic projects structure are similar as Angular projects, you can get use
ionic info
command to Print project, system, and environment information.
This command is an easy way to share information about your setup. If applicable, be sure to run ionic info within your project directory to display even more information.
We may use --json after ionic info to print system/environment info in JSON format
ionic info --json
on your terminal run this command on your ionic project folder ionic info and you will get the following :
cli packages: (/usr/local/lib/node_modules)
#ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
#ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.0.0 ios 4.5.5
Ionic Framework : ionic-angular 3.9.2
System:
Node : v8.9.3
npm : 6.1.0
OS : macOS
Xcode : Xcode 10.1 Build version 10B61
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro
You can find the library version accessing the file package.json. Under dependencies, check the property ionic-angular.
You can also check the Ionic CLI version typing ionic info in the terminal from your project's folder.
Running ionic info on your project directory give all the info you need the npm version, cli, app script and some more
for slower machines use the browser console.
Ionic.version
It doesn't do much analysis like the terminal's
ionic info
which gathers other useful information about your ionic project.
The method version on ionic object returns the current version in string format.
$ ionic info
Ionic:
Ionic CLI : 5.4.16
Utility:
cordova-res : not installed
native-run : 0.3.0
System:
NodeJS : v12.16.1
npm : 6.13.4
OS : Linux 5.3
────────────────────────────────────────────────────────────
Ionic CLI update available: 5.4.16 → 6.2.2
The package name has changed from ionic to #ionic/cli!
To update, run: npm uninstall -g ionic
Then run: npm i -g #ionic/cli
────────────────────────────────────────────────────────────
ionic info
This will give you the ionic version,node, npm and os.
If you need only ionic version use ionic -v.
If your project's development ionic version and your global versions are different then check them by using the below commands.
To check the globally installed ionic version ionic -g and to check the project's ionic version use ionic -g.
To check the project's ionic version use ionic -v in your project path or else ionic info to get the details of ionic and its dependencies.
ionic -v
Ionic CLI update available: 5.2.4 → 5.2.5
Run npm i -g ionic to update
You can use command ionic info to get details of ionic CLI , angular CLI , Node JS version and NPM version
Run command ionic info
in project root folder and you will get complete information of versions
Ionic:
Ionic CLI : 5.4.16 (/usr/local/lib/node_modules/ionic)
Ionic Framework : #ionic/angular 5.3.2
#angular-devkit/build-angular : 0.1000.8
#angular-devkit/schematics : 10.0.8
#angular/cli : 10.0.8
#ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : none
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 4 other plugins)
Utility:
cordova-res : not installed
native-run (update available: 1.4.1) : 1.3.0
System:
Android SDK Tools : 26.1.1 (/home/rasharma/Android/Sdk/)
NodeJS : v12.14.1 (/home/rasharma/.nvm/versions/node/v12.14.1/bin/node)
npm : 6.13.4
OS : Linux 5.11

flutter - xcode11 - macOS catalina - cocoapod install error

Calling macOS experts...
Appreciate your help into looking at this issue on pod install on flutter-- details are here
command used
/usr/local/bin/pod install --verbose
CocoaPods : 1.9.1
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
RubyGems : 3.1.2
Host : Mac OS X 10.15.4 (19E266)
Xcode : 11.4 (11E146)
Git : git version 2.24.1 (Apple Git-126)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
cocoapods-deintegrate : 1.0.4
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.1.0
cocoapods-trunk : 1.4.1
cocoapods-try : 1.1.0
ERROR
RuntimeError - [Xcodeproj] Unknown object version.
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.15.0/lib/xcodeproj/project.rb:227:in
2 steps to fix..
gem install cocoapods --pre
gem install mygem --user-install
and voila. your problems for days is solved...
What could help:
gem install cocoapods --pre
and maybe
gem update
If it doesn't help, check if your project format is correct:
Sources: https://github.com/CocoaPods/CocoaPods/issues/7697
https://github.com/CocoaPods/CocoaPods/issues/7458

"Could not connect to lockdownd" while attempting to run flutter app

I am following the Get Started tutorial.
I can install everything, flutter doctor returns all checkmarks but in the end there is a message:
idevice_id returned an error:
ERROR: Could not connect to lockdownd, error code -2
Same message appears if I try to run the app using flutter run or if I try to list the devices using flutter devices.
The tutorial also states that:
Note: If the Run & Debug buttons are disabled, and no targets are listed, Flutter has not been able to discover any connected iOS or Android devices or simulators. You need to connect a device, or start a simulator, to proceed
I have two devices listed my Android phone and an iPhone simulator. Run and Debug buttons are ENABLED!
How can I run my app using flutter? It can be either using the command line or IntelliJ IDE.
Disconnect all iOS devices, then:
brew uninstall ideviceinstaller
brew uninstall libimobiledevice
brew install --HEAD libimobiledevice
brew link --overwrite libimobiledevice
brew install --HEAD ideviceinstaller
brew link --overwrite ideviceinstaller
sudo rm -rf /var/db/lockdown/*
Connect an iOS device, and choose "Trust" when prompted, after that:
sudo chmod -R 777 /var/db/lockdown/
This workaround worked for me when loosing the connection:
close everything (Visual Studio Code, Xcode, Simulator)
disconnect any physical device
Start Visual Studio Code
connect a physical IOS phone
Start XCode
build from XCode (it will work)
Disconnect your physical device
Start without debug
You will be prompted to connect to a device
and from there it worked again!
This just to help to debug the loos of connection bug. I have also observed that it begins just after the "stop debugging" command from Visual Studio Code.
I was having similar issues, and resolved them using the below. Hopefully this will help you. flutter doctor was telling me the answers, but they were a bit buried. Look for something like this:
[-] iOS toolchain - develop for iOS devices (Xcode 8.3.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 8.3.3, Build version 8E3004b
✗ libimobiledevice and ideviceinstaller are not installed or require updating. To update, run:
brew uninstall --ignore-dependencies libimobiledevice
brew install --HEAD libimobiledevice
brew install ideviceinstaller
• ios-deploy 1.9.1
✗ ios-deploy out of date (1.9.2 is required). To upgrade:
brew upgrade ios-deploy
• CocoaPods version 1.2.0
There are four brew commands in there to run. When I did them, this problem disappeared for me. Good luck!

Failed to install phonegap-plugin-push

I am following Ionic Push setup guide but I am getting an error trying to install phonegap plugin:
cordova plugin add phonegap-plugin-push --variable SENDER_ID=123456789 --save --verbose
Im getting and error:
Error: Invalid Version: broken
this is ionic info --verbose generate following output:
[DEBUG] Loading global plugin #ionic/cli-plugin-proxy
[DEBUG] Throwing PLUGIN_NOT_INSTALLED for global #ionic/cli-plugin- proxy
[DEBUG] Loading local plugin #ionic/cli-plugin-cordova
[DEBUG] Loading local plugin #ionic/cli-plugin-ionic-angular
global packages:
#ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Ionic CLI : 3.5.0
local packages:
#ionic/app-scripts : 1.1.4
#ionic/cli-plugin-cordova : 1.4.1
#ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms : android broken
Ionic Framework : ionic-angular 2.2.0
System:
Node : v6.9.1
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 3.10.8
Can anybody point me in the right direction?
Follow this link ::
https://github.com/phonegap/phonegap-plugin-push
Try to install plugin using this command
cordova plugin add https://github.com/phonegap/phonegap-plugin-push

An error occurred while running cordova plugin add de.appplant.cordova.plugin.local-notification

While attempting to install the cordova plugins for local-notification for an Ionic Framework cross platform app I received the following:
Installing "de.appplant.cordova.plugin.local-notification" for android
Plugin dependency "cordova-plugin-device#1.1.4" already fetched, using
that version. Dependent plugin "cordova-plugin-device" already installed on android.
Failed to install 'de.appplant.cordova.plugin.local-notification': Error
at
/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:205:33
I've already tried the solution at https://github.com/katzer/cordova-plugin-local-notifications to no avail. All I'm trying to do is load the plugins as described on Ionic's site: https://ionicframework.com/docs/native/local-notifications/ and I they won't install the plugins.
$ ionic cordova plugin add de.appplant.cordova.plugin.local-notification
$ npm install --save #ionic-native/local-notifications
It is quite possible that you have Yarn installed, and that it is clashing with your version of NPM. Try removing Yarn, and your node_modules and re-installing.
For example, if you are using Brew, you could do the following:
# Uninstall Yarn
brew uninstall yarn
brew update
brew doctor
# Uprade Node & NPM
brew upgrade node
npm install -g npm#latest
Then in your project directory:
cd my-cordova-project
rm -rf node_modules
Check your package.json for broken links, for example: package dependancies with no version number that linger from installs that did not complete.
{
"name": "helloworld",
"displayName": "HelloCordova",
"version": "1.0.0",
"description": "A sample Apache Cordova application that responds to the deviceready event.",
"main": "index.js",
"dependencies": {
"cordova-android": "^6.2.3",
// FAILED INSTALL MIGHT CREATE EMPTY VERSION!
"cordova-plugin-app-version": ""
},
"cordova": {
"plugins": {
"de.appplant.cordova.plugin.local-notification": {},
"cordova-plugin-app-version": {}
}
}
}
Now install everything again with npm:
npm install
Here is my version info in case that helps you debug:
node --version
v8.1.4
npm --version
5.3.0
cordova --version
7.0.1