Is it possible to set debug points for Java and Objective-C with Visual Studio Cordova? - visual-studio-cordova

I am trying to figure out a way to debug native Java and Objective-C code for a Cordova plugin, and I was wondering if it is possible to use Visual Studio Cordova to do this on my Mac. Ideally, I would like to hit these debug points at runtime. I have seen videos and other tutorials showing that it is possible to set debug points in JavaScript, which is helpful, but not what I'm trying to accomplish.

Unfortunately neither Java nor Objective-C debugging is supported by Visual Studio Tools for Apache Cordova today.
Cordova generates a native Android and iOS project under the hood (which I am guessing you know given you're doing plugin development). VS can be used to generate the underlying Android or iOS project, but you'll need to use native tools to debug Java or Objective-C. If you're using the "remotebuild" agent, you can find the generated Xcode projects under ~/.taco_home/remote-builds/taco-remote/builds.

Related

Xamarin Android app out of the box shows undefined Android.Support, Android.Views, Android.Content in MainActivity

I needed to rebuild my fairly ancient Xamarin Forms app from scratch and in the process arrived at a situation where I had a new working iOS app but had needed to delete the draft Android app and start it again. So as a next step I added a vanilla Android app project out of the box and immediately what I saw was that (in MainActivity) Android.Support, Android.Views and Android.Content were undefined with wiggy red lines beneath -- for example in a reference to Android.Support.V7.Widget.Toolbar.
Trying to solve the problem, I set each of Target Framework, Minimum Android Version and Target Android Version to Android 9.0 Pie (API Level 28). In SDK Manager I checked that Android SDK Location and Java SDK Location were 'Found' and that Android SDK Platform 28 was installed.
The following NuGets came installed along with the project, I deleted them and reinstalled them (removing bin/obj folders in between): Xamarin.Android.Support.Core.Utils, Xamarin.Android.Support.CustomTabs and Xamarin.Android.Support.Design.
I tried installing NuGets Xamarin.Android.Support.v7.*. And I added the Xamarin.Forms NuGet. I tried adding 'use' declarations.
None of this helped.
For comparison I separately installed a blank Android app solution-- it worked perfectly out of the box.
Android is pretty new to me - would be grateful for suggestions on fixing this.
The app has a .NET Standard 2.0 project, an iOS project, the (vanilla) Android project (all three with Xamarin Forms), and a .NET Standard 2.0 library project.
I'm using Visual Studio for Mac V8.5.4 (stable) on MacOS 10.15.3.
I noticed that the content of MainActivity.cs is quite different, depending whether the Android project is created separately or as part of a Xamarin Forms solution. Also the provided NuGets are different. So perhaps what I was trying to do, adding an Android app to an existing XF solution, is simply not allowed.
To fix the problem, I created an empty Xamarin Forms solution with Android and iOS projects, added a further empty library project, then in Finder replaced the content of all the project folders, except the Android one, with the content of the corresponding folders in my working solution (the one with a working iOS app).
Migrating to AndroidX is a good idea though.
I don't know if this will help, but you should migrate to AndroidX as soon as possible, nevertheless. Xamarin has migrated to them, starting from Forms 4.5
Here is some more information about the libraries - Introducing AndroidX for Xamarin
There is a special NuGet package for the migration - Xamarin.AndroidX.Migration. Also available is a built-in functionality in Visual Studio - here
What I can suggest is you try to migrate to AndroidX libraries, since the old support libraries won't be supported from now on, and you will surely encounter some issues if not like this one, then something else will pop-up in the future.

Can we build a Xamarin based android system application in visual studio or Android studio IDE?

I want build and debug a xamarin based "SYSTEM" android application in visual studio. Is it doable?
Yes it is doable, therefore you need this:
Xamarin.Android 7.5 or later
Android Studio 3.x with Java 1.8
More information how to set up the system you can find here.
Here is some basic information from MSDN that you can start with for distributing your Xamarin.Android app as a System app.
It's difficult to provide specifics on this topic because the way you go about doing this can shift dramatically depending on your setup. Even MSDN states that. The article provided though is a great starting point to begin to understand how to go about installing your app as a system app.

XamarinForms CustomRenderer with .net standard 2.0 and prism7

I am trying out Prism7 together with AutoFac in a xamarinforms project.
I am trying to create a custom renderer for an entry control, nothing fancy here.
But for some reason i cannot get a reference to xamarin.forms and xamarin.forms.platform.ios/android namespaces in my ios and android project.
The project is based on the prism7 templates and the pcl is a .net 2.0
Normally I would expect
[assembly: ExportRenderer(typeof(Entry), typeof(BorderlessEntryRenderer))]
to work and connect my renderers but as said cannot reference xamarin.forms.
Anyone got an ideer?
I made it work.
Solution was to open project in Visual Studio Mac (I was in pc version before).
Then there is no problem seeing the namespaces. Rebuild and run both projects to see them work.
Go back to visual studio pc version and continue work there. If you have Resharper you need to clear cache otherwise it will look like you still have errors.
Must be a Visual Studio Pc or Resharper bug. Maybe I should use Mac version from now on :-)
I had the same problem. That's how I fixed it:
Add the correct references (ex: using myproject.myrenderers;)
Close the solution and Visual Studio (Windows).
Delete all bin and obj folders in the solution (including each platform).
Open VS and the project.
Clean.
Rebuild.
Done.

Does VS2017 support Edit & Continue in Xamarin forms?

I'm just starting out with Android development using Xamarin in Visual Studio 2017.
This question suggests that E&C isn't possible, but that was a couple of years ago.
Is it still not possible to put a breakpoint somewhere in, for instance, MainActivity.cs, and then edit the surrounding code when it hits the break?
I'm using an Android 6.0 emulator created using the Android Virtual Device manager.
This feature is not yet available in Visual Studio 2017 for platforms like Android and iOS however this works on UWP platform.
In this comment. Rodrigo Kumpera says:
We're constantly evaluating what's the best to do for our users. We
know how awesome it would be to have Edit and Continue - we really do.
That proves that this feature is not yet available.

Visual Studio 2015 Cordova iOS .ipa Location

I'm trying to release an iOS app built using Visual Studio 2015 Cordova Tools. I can deploy to the simulator and to my device just fine. But I can't find where the .ipa file is being created? My bin/iOS/release folder is empty even after cleaning solution, restarting, and rebuilding.
I have not tried with the latest versions, but I never found that I could build a release version from VS for iOS. I always went and opened the project on the Mac with XCode, using the project in the remote-build folder, tweaked the project settings (VS project never seems to allow multiple device orientations, I need to check on the others, choose the correct developer profile, and usually correct the bundle identifier). Then build and submit to app store from XCode as a normal iOS app.
Perhaps the latest versions are better on this, but I doubt you will find the app bundle in your VS solution folders, it would have to be on the Mac.

Resources