Visual Studio Cordova - can't deploy app - ios

I'm using Visual Studio Enterprise 2015 with Cordova Tools. I have simple bootstrapped HTML5 app, and an iMac running the remotebuild agent.
I have an iPad connected to my Windows machine with VS, and I'm selecting Debug -> iOS -> Local Device
VS seems to successfully post the build request to the iMac, it builds successfully, but then VS output window repeats over and over that "build completed successfully".
I can't see how to install my app on the connected iPad - I've installed a provisioning profile, and have iTunes installed, but no idea what is supposed to happen next.

Its a bug in visual studio 2015 and seems to effect ios developers running OSX Yosemite (Most reports were coming from that version)
there are 2 common problems with git integration in the transformation process(its likely that your project has created one during the transfer):
.git* (.gitignore and etc.) are located in wrong folder
.git* (.gitignore and etc.) are configured improperly
Solution:
move anything .git* to your root folder. i.e the folder with .sln file except the ones located in other platforms' (android, etc.) folder, they are probably located in the project folder(one level inside root project folder) or less likely, the www folder.
reconfigure your .git* files, since its not a git related question i'll try not to bother with details but an example visual studio .gitignore can be found
here (it will most likely solve your problem alone)
Hope the answer was helpful, btw let me know whether the solution has fixed your problem, there are plenty of bugs in cordova development in V.S 2015 and your best bet is to wait for update 1 unfortunately.

Related

Xamarin.Forms - Build Errors when trying to deploy to local iOS Device - "The given path's format is not supported"

The Issue
I have a Xamarin.Forms app, which runs fine in Android and iOS Simulators, as well as on a physical Android device.
But when I try to deploy to a local physical iOS device, Visual Studio reports a number of similar build errors, all relating to files that I have in the wwwroot folder.
For example:
Unable to copy file "..\BlazorHybridApp\wwwroot\weather.json" to "C:\Users\JohnDoe\AppData\Local\Temp\Xamarin\HotRestart\Signing\BlazorHybridApp.iOS.app\out\Payload\BlazorHybridApp.iOS.app\D:\Dev\MobileBlazorBindings\BlazorHybridApp\BlazorHybridApp\wwwroot\weather.json". The given path's format is not supported. BlazorHybridApp.iOS
Similarly:
Unable to copy file "..\BlazorHybridApp\wwwroot\css\app.css" to "C:\Users\JohnDoe\AppData\Local\Temp\Xamarin\HotRestart\Signing\BlazorHybridApp.iOS.app\out\Payload\BlazorHybridApp.iOS.app\D:\Dev\MobileBlazorBindings\BlazorHybridApp\BlazorHybridApp\wwwroot\css\app.css". The given path's format is not supported. BlazorHybridApp.iOS
Looking at the error detail, the destination path does appear to be malformed.
Interestingly, some of the files included in the build errors are not in fact referenced anywhere within the program code as it stands (e.g. the weather.json file), and so I'm led to believe it's not a referencing/path issue within the program code itself. It seems sufficient for a file to appear in the wwwroot folder (or one of it's sub-folders) for it to generate a build error, but ONLY when building for a physical iOS device.
The Environment
Mac
I'm including the Mac details for completeness, but it seems the build doesn't get as far as the Mac before stopping with build errors.
Xcode 12.5
Windows
Windows 10
Visual Studio 2019 version 16.10.4
I have disabled "Hot Restart" in Tools > Options > Xamarin > iOS Settings in case it was messing things up.
And the files within the wwwroot folder are set as follows within VS:
Can anyone suggest anything I might try?
I managed to "resolve" the issue myself, well, at least side-step it.
When I was getting the build errors, I was trying to deploy to a physical device connected to my Windows machine.
If instead I connected the device to the Mac, and ran the same build process on Windows, the build completed with no errors.
Another weird quirk of Visual Studio, it would seem.

Android Studio : "Unable to locate adb"

I just installed Android Studios and trying to build my first app. When I press play on the emulator the message "unable to locate adb" pop-up. How to solve this problem?
I had this problem when updating to Android Studio 4.0.
I even tried uninstalling (and doing a full cleanup) Android Studio and installing again. The problem persisted.
The problem was that when importing my old project, the new Android Studio couldn't find the SDK and my project had no SDK (even though it could build, go figure).
So check File -> Project Structure -> Project. In my case there was a big red NO SDK set there. Once I set the SDK to the one installed, problem was solved.
I guess you didn't set the system and user environment path in your windows.
Goto properties of This PC > Advanced System Settings > Environment Variables > Path > then put the path file location.
intel android driver setup install this after its worked for me

What is causing this build error targeting iphonesimulator from Visual Studio?

I'm getting these errors, building for any iOS simulator:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(473,3): error MSB3231: Unable to remove directory "obj\iPhoneSimulator\Debug\". The directory is not empty
OR
SeverityCodeDescriptionProjectFileLineSuppression StateSuppression State Error Unable to remove directory "UserControls". Access to the path 'D:\Projects\Solutions\mycompany\iOS\obj\iPhoneSimulator\Debug\UserControls' is denied.mycompany.iOS
OR both together...
I'm using VS 2019 version 16.3.7 on Windows 10 machine and Xcode 11.2.1 on Mac Mini, OSX 10.14.6 and it does not matter which iOS simulator targeted, all version 13.2.2. Developing a Xamarin Forms application.
If I switch to target one of my hard devices, I get multiple errors like this:
error : Access to the path 'D:\Projects\Solutions\mycompany\iOS\obj\iPhone\Debug\Popups\TemplatePicker.xaml.g.cs' is denied.
I can work around this by quitting VS, removing read-only flag on the obj folder and all it contents, run VS as admin, THEN it builds and pushes to the device.
Switching back to target a simulator, I get the first error again.
Deleting Bin and Obj folders does not help either.
Side note - this was working until Windows rebooted itself on my dev machine, closing VS and forcing recovery of some files. Android version works just fine in simulator and hard device, no issues.
Wondering if I upgrade VS to version 16.4.5 and Xcode to 11.3.1, this might be resolved. Any ideas?
Are these version compatible with the latest VS-Xcode connector? (I've seen issues with version incompatibility) .
Any ideas? Resolutions?
Thank you
OK, here's what I've found...
The connection and link to XCode from VS on the PC causes a lock or some sort when targeting any iOS simulor. This is intermittent but once the locks are imposed, one needs to
close VS
quit the Simulator on the Mac.
delete the Obj and Bin folders in the solution
Re-open VS, open the project, let it sync with the Mac.
Restart Simulator on the mac
Rebuild. This could take a couple iterations too.
If that does not clear the problem, shut down both machines, remember to delete Obj and Bin folders.
Frustrating, slow, but it works for me for now.

APK fails to be installed on any device

I'm new in the Xamarin Development world so I installed Visual Studio 2017 with all the needed cross compiler features.
After downloading and updating the SDKs for Android API 23, 24, 25 and 26 and some corresponding emulator images I got the emulators starting up.
I created a base Xamarin Android App within VS, compiled and deployed it to the simulator.
By deploying/installing the generated APK to the simulator I get the following error:
Failure [INSTALL_FAILED_INVALID_APK: Package couldn't be installed in /data/app/BlankAndroid.BlankAndroid-1: Package /data/app/BlankAndroid.BlankAndroid-1/base.apk code is missing]
It doesn't matter which SDK I choose as “Target Framework” or which Simulator I choose (Android 6, Android 7 or 7.1). The result is the same: The apk is not installed, but the “Mono Shared Runtime” are present and will be updated.
I figured out that the created apk file does not contain a file “classes.dex” or any oder dex files just some ressources. A file “classes.zip” in the directory “obj\Debug\android\bin\classes” with the generated java classes out of my C# is present. These files should be compiled with the DEX-Compiler to the classes.dex file, when I understood correctly.
Even other sample projects from the Internet have exactly the same result.
What do I do wrong?
The problem got solved by fresh installing the Android SDK and all related components. It seemed to have a SDK missmatch between an old Google Android SDK and the new installed Xamarin Android SDK.
I faced the same problem and tried many solutions from the search in web but this one to an extent solved that deploy failure issue.
In the emulator, open settings -> Apps -> Uninstall your app if it is listed
Deploy the app from visual studio again.
This solved the problem that said base.apk is missing.
Try setting your project back to the current recommended defaults. Remove all of the following properties from the .csproj file:
AndroidEnableMultiDex
AndroidDexGenerator
AndroidLinkTool
AndroidDexTool
This will let Xamarin.Android pick the current latest default values, this apply for Visual Studio for Mac and VS 2017-2019

Visual Studio 2015 hangs on deploying cordova application

I'm trying to build a blank cordova application into my iPad Air 2 with Visual Studio 2015 Enterprise edition as i've already done it with success with the release candidate version.
I've got node.js v 4.2.2 on both machines since version 5.2.0 was hanging the build indefinitely, i've also got latest version of iTunes (12.3.1) as well as iOS 9.2 on the mobile device.
I've got the remote MAC set up and everything works fine for the building part, infact i've checked and the .ipa file is there at the end of the build into the folder ...\Documents\Visual Studio 2015\Projects\BlankCordovaApp1\BlankCordovaApp1\bin\iOS\Debug and if i launch that it will correctly install into iTunes and the iPad itself.
The problem is that the build action with Configuration "iOS" and "Local Device" with the iPad connected to the windows 7 PC will hang indefinitely after copying back said .ipa file after writing this line into the Build Output:
2>------ Deploy started: Project: BlankCordovaApp1, Configuration: Debug iOS ------
No matter how much time i wait it wont start the debug session even if i authorized the pc onto the iPad and have my web Inspector turned on onto the safari options. At this point i have to interrupt the build to be able to work again.
What really gets me is that if i connect the iPad to the MAC machine and build with "Remote Device" option the build works fine and i can debug remotely from my windows pc, unfortunately working like that isn't an option since the Apple machine isn't in the same room of my developing machine.
Any insight about this issue would be really appreciate, thanks in advance.
You are using a recent version of node and thus will also need to use a recent version of Cordova.
Specifically, you need to use Cordova 5.3.3 to be able to use Node.js 4.x.x+. The hang you are experiencing is exactly why. It's an incompatibility with a down stream node module and Node 4.x.x. You can downgrade to Node 0.12.x or upgrade your Cordova project to 5.3.3.
http://cordova.apache.org/news/2015/09/22/tools-release.html
Note that Node 5.x.x is only supported in Cordova 5.4.1.
This should be addressed in the latest VS Tools for Cordova Update 6. Deploying to local device is now available.
Take a look at http://microsoft.github.io/vstacoblog/2016/02/04/announcing-update-6.html.

Resources