How to upgrade a cordova app and plugins - xcode

I have a Cordova (v5.2) app that I run on iOS (platform v3.9.1) and Android (platform v5.0). Is it best to upgrade Cordova from the command prompt, and then manually look for plugin updates, or should I look for plugin updates first then update Cordova? Also, I have recently upgraded from XCode 7.2 to XCode 8 and it is asking me to make changes to recommend project settings, this appears to break thinks. Should I allow XCode to make changes to the project, or should I upgrade Cordova first? I'm looking for a workflow and best way to manage these updates. Any advice is appreciated, thank you.

I would upgrade your Cordova platform first. The main version that I pay attention to is the cordova platform version. So in your case cordova-ios#3.9.1 and cordova-android#5.0.0. These packages are what control the cordova lib that gets injected into your native project. They also determine which version of Xcode you can use.
The cordova-cli pins certain platform versions by default when you run cordova platform add <platform_name>. I usually stick with the most stable release of cordova-cli for my needs and then add specific platforms (usually the latest) manually. cordova platform add ios#lateset.
Any partiular reason you're cordova#5.2, cordova-ios#3.9.1 , and cordova-android#5.0.0?

Infact you can also create a new project after cordova update and add the respective platforms and plugins so that the existing working project will be intact for reference.
If you wanna follow this approach then check out this following SO post. Even that post is related to porting cordova app from one PC to other, the steps still holds good even in this case. Hope it helps.

You should upgrade Cordova first (it's better if you install it globally with npm install -g cordova ).
After that, to update all of your plugins, you just have to remove them and readd them to your project, they will automatically be updated to be compatible with the last Cordova version.

cordova platform remove android
cordova platform add android#5.X.X
If you use the above method, be aware that any changes you made to the android platform folder will be lost (editing the contents of this folder is discouraged).
Alternatively, you may attempt to use the platform update script. For non-CLI projects, run:
bin/update path/to/project
For CLI projects:
Update the cordova CLI version. See The Command-Line Interface.
Run cordova platform update android#5.0.0 in your existing projects.

Related

Found conflicts between different versions of "System.Numerics.Vectors" in Xamarin Forms 5 project

I'm building a new Xamarin Forms 5 app using VS 2022 17.1.1. Everything in the project appears to be up-to-date.
I've been working on this project for a while and never had this issue. All of a sudden it just appeared today. The last action I took was to install the Plugin.InAppBilling package, thought the package in question is not used by the Plugin.InAppBilling package.
The error is as follows:
All I can see is that the shared project is using System.Numerics.Vectors version 4.5.0 and it seems to be dependency of Xamarin.Essentials which is version 1.7.1 in my project.
However, the version number of System.Numerics.Vectors seems to be 2.0.5.0 in the Android and iOS projects.
I found the GitHub issue here but I'm not seeing any clear resolution to this issue. Even though it appears to be a warning, in my case, I can no longer run the app because I keep getting deployment error to the Android Emulator or actual device. It simply refuses to deploy my app to the device/emulator. So, it's really NOT a warning in my case. It's a show-stopper. I'm a bit surprised about how lightly the Xamarin Essentials folks seem to have taken this issue on GitHub.
Has anyone actually resolved this issue? If so, what's the solution?
BTW, in my case both the Android and the iOS projects are throwing this error/warning and both use System.Numberics.Vectors version 2.0.5.0 even though the shared project has version 4.5.0 installed as a dependency undre Xamarin Esssentials.
I'd appreciate some pointers on how to make this issue disappear. Thanks.
At first, you can try to update the Xamarin.Essentials package in the Android and IOS project with the nuget package manager to the version 1.7.1.
And then, if the error is still here, you can right click the reference and remove the reference of the System.Numberics.Vectors 2.0.5.0 both in your Android and IOS project. Then download the System.Numberics.Vectors 4.5.0 in the nuget package manager both too.

Xamarin forms build success but deploy failed

I receive this warning when ever I try to deploy my Xamarin.Froms app to any device or emulator. Also the deploy fails without any errors. I cannot run my app. Can Any one please help me?
The $(TargetFrameworkVersion) for Xamarin.Forms.Platform.dll (vv8.0)
is greater than the $(TargetFrameworkVersion) for your project (v7.1).
You need to increase the $(TargetFrameworkVersion) for your
project. App2.Android C:\Users\subas\source\repos\App2\App2\App2.Android\App2.Android.csproj
EDIT/UPDATE
Right now JDK9 and the Android SDK tools are not compatible with each other - thus Xamarin.Android does not work with JDK9.
Run the following to see the version of java you have installed:
java -version
If it reports something along the lines of java version "9.0.4" you have JDK9.
Specifically there's an issue with the apksigner. It's not using the -classpath switch that the JDK expects.
Easiest way to fix is to install the JDK8 and make sure your PATH is pointed at it.
This documentation gives a solid overview.
ORIGINAL
Sounds like the target Android framework in the project needs to be updated to point to the latest version of Android.
First - make sure you have the latest Android SDKs installed. Here's some documentation on that.
Once you have the latest - here is how to make sure you're targeting the latest - depending on the IDE you're using:
Visual Studio Mac
In the solution explorer, right click the Android project and select options.
Under the Build -> General node - select "Use latest installed platform" from the Target Framework dropdown.
Save everything, close the solution, restart VS-Mac
Visual Studio
Right click the Android project in the solution explorer and select properties
Under the Application node, select Use Latest Platform from the Compile Using Android Version dropdown.
Save everything, close the solution, restart Visual Studio

Can't upgrade to newer versions of Gradle in Android Studio, nor update AS itself

I'm working with Android Studio (Beta) 0.8.14.
I wanted to update the Gradle distribution and the Gradle plugin in my project, so I started manually changing the lines:
classpath 'com.android.tools.build:gradle:0.13.+' (in build.gradle)
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip (in gradle-wrapper.properties)
by upgrading to, respectively, 1.0.0 and 2.2.1. Then I tried to use different combinations found here on SO, e.g. 0.14.4 and 2.2, as none of these seemed to work. For each combination I got (after syncing and downloading what needed) some error, like:
AssertionError: null
AssertionError: com.android.tools.idea.gradle.project.AndroidGradleProjectComponent#71c8dfe3
UnsupportedMethodException
Unsupported method: SourceProvider.getJniDirectories().
The version of Gradle you connect to does not support that method.
After some research I thought this might be related to AS itself. Looking for updates in different channels brings me either to AS 0.9.9
This patch will allow you to update from 0.x to 1.x. After updating,
please check for updates again to install 1.x.
or to AS 1.0.2.
When trying to update, I get hundreds of errors related to Android Studio not deleting some files in android_SDK_folder/sources/android-21 , mainly.
This issue has some references here on SO. Known fixes are killing java processes during the update, which was unsuccessful for me, and launching Android Studio as admin, which doesn't look like a great idea to me (and I wouldn't know how to on OS X).
I'm stuck. My questions are:
are the Gradle syncing errors due to my old build of Android Studio?
if so, what can I do to update? I don't think I should uninstall and then get 1.0.2, as the message I reported says I can patch to 0.9.9 and then to 1.x. Is this the only thing to do?
Yes, your Gradle syncing errors are due to a mismatch between the plugin and the version of Android Studio. If you want to use v1.0.0 of the plugin, you need to be running Android Studio 1.0 or later.
As for upgrading, my advice would be to do a clean reinstall of 1.0; it will be easier than trying to spend a lot of time figuring out why the upgrade isn't working. I forget where the SDK is installed in 0.8.14, but we're encouraging/requiring users to have the SDK located outside the application directory itself, so it should help avoid future SDK woes with upgrading/reinstalling Android Studio itself.
If the SDK is currently installed inside Android Studio's directory and you don't want to re-download it, you could move it out to a more sensible place before reinstalling, and point the new installation at it.

PhoneGap Build doesn't update the app

PhoneGap Build shows successful build and log for Android, shows updated version on the PhoneGap Build web page, but when I install Android shows old version and the APK file is also old. I know for sure because I just put 2Mb of dummy images and the sise of the APK hasn't changed, so the problem is with build
Edit: it was a 1-day glitch, it works OK now
we see this problem every now and then. Our solution to it is to remove and ad back in the affected platform. Assuming you are also using the latest cordova tools do the following:
cordova platform remove android
cordova platform add android

Deploying Phonegap 2.x App Development on another Mac

I used to develop PhoneGap Apps by using 1.x PhoneGap library or Cordova library. After that, I use Cordova 2.x library, and I got confused.
I push my sources to Github and let my friends fork it. We don't know how to deploy the development environment on another Macbook even if that Macbook has the Cordova 2.x library.
First, we found that the project did not have the Cordova lib. So, we Added Cordova 2.x library into the project.But Xcode gave us an error.
If I built Cordova Lib Xcode said :
File
/Users/[MYUSERNAME]/Library/Developer/Xcode/DerivedData/[MYAPPNAME]-gfayprtpflnyaqcwfmepqwlyjglq/Build/Products/Debug-iphonesimulator/libCordova.a
depends on itself. This target might include its own product. build
cordova 2.x Lib
If I build MYAPPNAME Xcode said :
Unknow type name "CDVViewController"
in phonegap folder you find something called update script run it and give it your project adress it should do the job(update references and more) you could find more in phonegap website
Finally I solve my problem by reading this article.
And follow the steps like the author's saying ...
Here is the link : http://zsprawl.com/iOS/2012/10/installing-cordovaphonegap-2-1-for-ios/

Resources