Unable to update to Capacitor to version 2.1.0 - capacitor

Currently, I am in Capacitor 1.5.2 in my Ionic 5 project. Following is the result of running npx cap doctor
đź’Š Capacitor Doctor đź’Š
Latest Dependencies:
#capacitor/cli: 2.1.0
#capacitor/core: 2.1.0
#capacitor/android: 2.1.0
#capacitor/ios: 2.1.0
Installed Dependencies:
#capacitor/cli 1.5.2
#capacitor/ios 2.1.0
#capacitor/android 1.5.2
#capacitor/core 1.5.2
I have followed this document and run all the commands but only the ios got updated with a few audit issues. I have tried multiple times but unable to update cli, core and android. Am I missing anything here?

npm update respects semver, so it will never update to latest Capacitor if you are in v1.
Instead, use npm install #capacitor/android#latest (replace android with other capacitor package names you want to update)

Related

Flutter Downgrade Command

I want to downgrade my flutter from flutter version 3.0.1 to flutter version 2.10.5.
When i try to run the following command:
$ flutter downgrade 2.10.5
i got the following message instead:
Flutter Downgrade Message
How can i downgrade my flutter version to version that i want?
PS: I'm using OS ubuntu 20.04
Extra reference:
Extra Reference
you can not downgrade to specific version. The downgrade command works only for the version you used just before the upgrade.
Example: If you upgrade from 2.8.1 to 3.0.1, the downgrade command will directly downgrade to 2.8.1
So, a workaround might be to use a Flutter Version Management tool. Using this, you can use any flutter version in any of you projects
The simple way is:
Download the version of Flutter you need and put it in the place where Flutter is installed In this directory you have "flutter" folder.
In Ubuntu, it is usually located in this path: /home/username/development/flutter
To develop the software with the desired version, just change the desired folder name to "flutter".
For example :
flutter --> flutter-3.x.x
flutter-2.x.x ---> flutter
The Stable channel contains the most stable Flutter builds:
https://docs.flutter.dev/development/tools/sdk/releases?tab=linux

Ionic 3 Native Plugin Social Sharing Error: Plugin not installed

I’m using an Ionic 3 app, trying to get social sharing working.
I followed the steps to install the Ionic Native Social Sharing plugin from: https://ionicframework.com/docs/v3/native/social-sharing/
Ran:
$ ionic cordova plugin add cordova-plugin-x-socialsharing
$ npm install --save #ionic-native/social-sharing#4
Imported the plugin (version 4.x.x) via my app module and added SocialSharing to the providers array.
Imported the plugin via my app.component using:
import { SocialSharing } from '#ionic-native/social-sharing';
Added to the constructor:
private socialSharing: SocialSharing
This share function, also in app.component is triggered via a button in the html (side menu):
async share() {
try {
// Pop the native social sharing sheet, allowing the user to choose how to share the app.
await this.socialSharing.share(this.shareMessage, this.shareSubject, this.shareFile, this.getShareUrl());
this.toast.show('Thanks for sharing!', 3000);
}
catch(err) {
console.error(err);
alert(err);
}
}
I’m using platforms: ios, android and browser.
When I call the method from a build on a real device I get the error:
"Plugin is not installed"
Tried:
Checking logs for installation errors. None seen.
Reinstalled plugin.
Checked plugin present using $ionic cordova plugin list. cordova-plugin-x-socialsharing 5.4.7 “SocialSharing” is present.
Removed and added all platforms again.
Wrapped the share method inside a platform.ready().
Nothing seems to be working. I cannot get the app to recognise the plugin is installed!
PLEASE HELP! :slight_smile: What can I try next?
Thanks
$ionic info:
Ionic:
Ionic CLI : 5.2.3 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.5
#ionic/app-scripts : 3.2.2
Cordova:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : android 8.0.0, browser 6.0.0, ios 5.0.1
Cordova Plugins : cordova-plugin-ionic 5.4.0, cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.5.1, (and 13 other plugins)
Utility:
cordova-res : 0.4.0 (update available: 0.6.0)
native-run : not installed
System:
ios-deploy : 1.9.4
ios-sim : 8.0.2
NodeJS : v11.2.0 (/usr/local/Cellar/node/11.2.0/bin/node)
npm : 6.9.2
OS : macOS Mojave
Xcode : Xcode 10.2 Build version 10E125
So according to your information your current installed plugin is version 5.4.7, to make plugins work with Ionic 3 you need to ensure you have installed 4.* version of the plugin.
Seems like you are using the right command for the install (adding #4 after the plugin install command).
Can you try uninstall the plugin and then attempt to reinstall and note which version its installing. You may have to try and install 4.* version:
npm install --save #ionic-native/social-sharing#4.12.0
I got an issue with cordova-plugin-x-socialsharing in Ionic3 and main issue was couldn't install cordova-plugin-x-socialsharing plugin properly(error: can't find plugin.xml for es6-promise-plugin).
Steps to fix:
Installed es6-promise-plugin : ionic cordova plugin add https://github.com/vstirbu/PromisesPlugin
Installed cordova-plugin-x-socialsharing : ionic cordova plugin add cordova-plugin-x-socialsharing
npm install --save #ionic-native/social-sharing#4

How to keep both ionic 1, 3, version in my system

Initaially i was working with ionic 1.7.6 version with many apps. And by today some how i have changed to version 3.0.0. Now when i open my old projects under package.json i see the version as 3.0.0 instead of 1.7.6. And when i do sudo ionic build android it throws me some error to upgrade the version.
So now i have uninstall the ionic & cordova from my system.
Now i want to keep ionic 1 version 1.7.6 as well as ionic 3 version 3.0.0 how can i do it now.
so when ever i open the ionic 1 project i need to work on angularjs with ionic 1 version.
And when ever i open the project that i have created with version 3 i need to work with latest version of angular is with ionic 3..
please some one expalain me what should i need to do ??
Thank in advance !
I suspect you have installed ionic globally. If you want to run the local/project version of ionic you need to sudo ./node_modules/ionic/ionic ....
This will be the version of ionic as defined in the package.json of the project.
You can tuck this nicely away however using npm scripts (in your package.json):
e.g.
"scripts": {
"ionic": "sudo ./node_modules/ionic/ionic build "
}
Ten simply execute npm run ionic -- android

ionic 1, I lost my app's icons and splashscreen

I am running my app on my phone this morning with
ionic run android -lcs
as usual ! But this morning the icon and splashscreen switched to default images !
Any idea how to get back to normal ?
Thanks
$ ionic info
Your system information:
Cordova CLI: 6.4.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v7.4.0
Xcode version: Not installed
Try to force update the android platform to version 6.1.0:
cordova platform update android#6.1.0
The current version (6.0.0) has a bug that causes this problem.
EDIT:
Cordova 6.5.0 has been released recently. This release updates cordova-android to version 6.1.1. So best solution now is:
npm install -g cordova

if i update cordova to a newer version is it necessary to update ionic and all other plugins? how does the changes effect?

I have updated cordova and all other plugins. When I tried generating apk, its showing
"doesnot have required environment or OS to install"
I am not able figure out where the problem is.
this is version info of my app..
Cordova CLI: 6.0.0
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.0
Ionic Version: 1.0.0
Ionic CLI Version: 1.7.7
Ionic App Lib Version: 0.6.3
OS: Windows 7
Node Version: v0.12.7
Did you tried removing Android platform?
ionic platform remove android
and then add it again:
ionic platform add android
or maybe this can be useful:
Cordova / Ionic build error (sometimes): don't have required environment