I'm trying to develop a Xamarin forms application and I'm having problems seeing namespaces in an Android class library I've added to the solution. Note, I'm using visual studio 2015 Community Version 14.0.25431.01 Update 3.
My Xamarin forms application solution contains the following projects.
XFormsApp(Portable)
XFormsApp.Android
XFormsApp.IOS
XFormsApp.UWP
MyCoreComsLib Preexisting PCL containing communications interfaces/abstractions, and cross platform utilities.
MyAndroidComsLib Preexisting Android specific implementations of the communications interfaces. This library references MyCoreComsLib. I believe MyAndroidComsLib is an "Android Class Library" project.
Right now I'm just trying to get the android implementation of the Xamarin forms app running so I added the following references between projects.
from MyAndroidComsLib to MyCoreComsLib
from XFormsApp(Portable) to MyCoreComsLib
from XFormsApp.Android to MyCoreComsLib
from XFormsApp.Android to MyAndroidComsLib
My Problem: When I work in CrossApp.Android I can't see any classes or namespaces from MyCoreComsLib or MyAndroidComsLib. However, when working in XFormsApp(Portable) I can access namespaces / classes in MyCoreComsLib. I've used the MyCoreComsLib and MyAndroidComsLib class libraries in android only c# projects so there aren't any issues with the visibility of classes.
I've done the following in an attempt to solve this issue.
Made sure MyCoreComsLiband MyAndroidComsLib built in the cross platform app solution.
Made sure the references to MyCoreComsLiband MyAndroidComsLib show up in the references list under the XFormsApp.Android project.
Restarted visual studio.
Created a brand new Xamarin forms app. Added a new Android Class library to the project. Added a reference from the NewFormsApp.Android project to the class library and attempted to access classes in the class library. Note, I wasn't able to see a class an in the new android class library so this leads me to believe this is a limitation with visual studio / Xamarin but I don't understand why this wouldn't be supported.
Thanks Everyone!
This has been confirmed as a bug in visual studio 2015 https://bugzilla.xamarin.com/show_bug.cgi?id=57991. I was able to resolve this issue by switching to visual studio 2017.
Related
I want to use agency tango materialintroscreen library in my Xamarin.Android project.
I have created a Xamarin Android Binding Project, copy the ARR file in the Jars Folder and set Build Action to LibraryProjectZip.
Then I reference the project in my main Xamarin.Android project.
Normally I can access to agency.tango.materialintroscreen but have the error the namespace doesn't exist.
I try to use jetBrains dotpeek I saw dll was create well with all class.
I have the same error with 3 library
Visual Studio Error list
Object Browser
Brand new install of Visual Studio Pro 2017, Prism Template Pack, and Xamarin Forms.
I am trying to create my first App and things are going very well so far. I have all the views, view models, etc. set and the app is functioning perfectly. Now I am trying to add some more PCL projects to the solution for things like Domain or Services, etc. so I can keep all the parts separated.
I can create a Xamarin Forms PCL just fine and add all my classes, etc. Problem comes when I try to add a reference to the Domain project from the main PCL project in the solution. I get the "targets of pcl don't match" error message.
This is what I am using to create the new PCL project:
This is the error message I receive when trying to add the PCL project reference:
What am I missing?
Here is the main PCL created with the template pack properties:
Here is the newly added PCL project properties:
PCL properties for template:
Since you are missing the Windows Phone & Silverlight targets in your IDE for some reason, this is a potential workaround:
Open up your .csproj files and make sure the TargetFrameworkProfile elements match up in both PCL projects.
Is it possible that you didn't install the tools for Windows Phone development when you installed Visual Studio?
I'm developing a xamarin forms class library (Custom Component) that targets (Windows, Androi and IOS) platforms "this library should be added to an existing Xamarin forms Portable project as DLL reference" and want to add a UI control and use it's native functions from inside the library. Custom renderers can't be added in PCLs so Can anyone help on how to access the control's native functionality?
You can start from scratch on your by following this piece of documentation by Xamarin on how to build NuGet packages. Then just make sure you build them without too much references and test them in your sample projects.
But to make your life a lot easier have a look at this Visual Studio extension by James Montemagno. It installs some project templates for you so naming is consistent and you have the basics already setup to start building your reusable code.
I want to experiment with Monogame in F# using Xamarin on OSX. I am able to create a working C# Monogame project and a working F# Cocoa app, but not a working F# Monogame project.
What is the boiler-plate setup for an F# Monogame project?
Are there Monogame F# templates available?
This is not a solution but a work-around: create two projects, one C# Monogame project and one F# console application. Both of these templates should be installed with Xamarin and Monogame.
Create a C# Monogame project
Create an F# console application
Edit the fsproj file so that it has OutputType Library
Link the F# project to the Monogame project
Add the Monogame package to the F# library using nuget
Write your Game class in F#!
Aside from the hassle of creating two projects, the main problem I've found is that every reference used in the F# library also needs to be referenced in the C# library or you will get runtime errors. I'm sure a custom build script could be written to fix this.
Under Visual Studio 2015, I have integrated Android C++ code into Xamarin and it works as expected. Now, I am trying to do the same for iOS and am running into some basic issues.
I am assuming the integration mechanism is the same for iOS as that of Android in the sense that a shared library (probably .so) is created that one can load using DllImport in C# code.
When I try to add a new C++ project for iOS to my solution, the only option that seems to make sense is Visual C++-->Cross Platform-->iOS-->Shared Library. I added this project type as MyTestShared. This actually ends up creating three projects - MyTestShared.Shared, MyTestShared.iOS, and MyTestShared.Android. Project MyTestShared.iOS already has an external method defined as char* iOSInfo(). However, when I try to add project MyTestShared.iOS as a reference to my MyMainApp.iOS project, I see an error "A reference to MyTestShared.iOS could not be added. An assembly must have a dll or exe extension."
Questions:
For Android C++, it generates exactly one project. Why does it create three projects for iOS C++?
How do I add a reference to MyTestShared.iOS? What is it that I am missing?
I see there is an option to create a static C++ library for iOS. Can I reference it somehow in my C# code?
Regards.