I am not able to use DrawerLayout in my project. In my android sdk manager, I have upgraded the "Android SDK platform-tools" to the latest revision (Rev. 22.3) and the "Android SDK Built-tools ( Rev. 19.0.1 ) as suggested in this post
https://forums.xamarin.com/discussion/4440/create-a-drawer-layout
Still I cannot find this component (DrawerLayout). Visual studio suggests to generate this class since it cannot find it in any referenced library. I have referenced Mono.Android.Support.v4.
( I am also using ActionBarSherlock libraries to target api levels <= 2.3).
Any help as to what i am doind wrong, where to investigate or what direction to take will be greatly appreciated. Thank you.
I would suggest upgrading your Xamarin.Android version and your current dlls to the new "Xamarin" versions.
EX:
<Reference Include="Xamarin.Android.Support.v4">
<HintPath>Components\xamandroidsupportv7appcompat-7.18.0\lib\android\Xamarin.Android.Support.v4.dll</HintPath>
</Reference>
You can add these by right-clicking the components folder and searching for support libraries.
Here's v4: https://components.xamarin.com/view/xamandroidsupportv4-18
Related
We are aware that in Xamarin.iOS, UIWebView will soon be deprecated and apps will not be accepted with deprecated versions.
I have created a new project here. I have followed this document here as well as other posts on internet to remove UIWebkit and replace it with WKWebview but it doesnt work.
Since its a new project, so no nuget packages are being used which could have had UIWebView. But still when i add --warn-on-type-ref=UIKit.UIWebView flag in mtouch arguments I get error:
One or more reference(s) to type 'UIKit.UIWebView' already exists
inside 'Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=null' before linking WebViewTest.iOS
How do I remove UIWebview complete from the basic project so my app can get accepted on testflight/appstore.
I am using Visual Studio 16.5.5 with Xamarin.iOS version 13.16 and I have tested on Xamarin forms 4.4 and 4.6 both
In project file WebViewTest.iOS.csproj remove --warn-on-type-ref=UIKit.UIWebView -warnaserror:1502 -warnaserror:1503
It should look like this
<MtouchExtraArgs>--optimize=experimental-xforms-product-type</MtouchExtraArgs>
Use latest Visual Studio for Mac
also set Linker behavior to SDK framework only or All - this is important
I am new to xamarin studio.
I have added all the required packages corresponding to the target API 23 to my android xamarin studio project, set it to the right target API 23 but am still being haunted by these errors in the image below. Any help rendered will be greatly appreciated
Image contains errors from an android xamarin studio project
Your compile SDK version must match the support library's major version.
Since you are using support library v23, you need to compile against Android SDK of v23.
Alternatively you can continue compiling against v22 of the Android SDK by switching to the latest support library v22.
I am trying to use protobuf-net with the new xamarin ios pcl, and it's nuget packet doesn't appear to support the framework. Is there a way to import protobuf-net into the pcl?
Update:
I just found recompiling the PCL with the new Xamarin PCL definitions allowed the resulting library to be references. Nice work! Let me know when a new version is posted to Nuget.
The NuGet package includes PCL drops, but it is unclear to me what change you would have me make to the NuGet package here, as there is no specific "Xamarin" target that I know of; the example targets are described here; protobuf-net currently includes a broad target of portable-sl4+net40+wp7+windows8. If you know of a target (or indeed a PCL build combination) that works for Xamarin for iOS, please let me know.
I should also note that the NuGet drop is the "Full" implementation, where meta-programming is performed at runtime. Because of the limitations in iOS, you may find you get better performance by using the "CoreOnly" implementation combined with the "precompile" tool, available from the google-code drop. This is described here.
I was able to use NuGet version of protobuf-net by manually editing the .csproj file for my portable library and setting the target framework profile to match protobuf-net:
<TargetFrameworkProfile>Profile136</TargetFrameworkProfile>
The resulting portable library worked well with Xamarin.Android. According to this list, it should work with Xamarin.iOS as well.
has anyone succeeded to adapt/port Json.NET to a version able to run under Unity3d deployed to iOS (and the webplayer, and android, too, but these seem less problematic), somehow overcoming the AOT issues there?
Or are there plans to release a compatible version of Json.NET?
Many thanks,
Max
You can use netstandard version of Newtonsoft.Json in Unity and it works fine. It seams that this library has changed some inner implementations to not use System.Reflection.Emit for deserialization anymore.
Just be sure that after downloading nuget package you get Newtonsoft.Json.dll from netstandard2.0 folder, not from net45. And also don't forget to specify in link.xml that System.Linq.Expressions.Interpreter.LightLambda class shouldn't be stripped (it's used for deserialization) along with libraries/classes that you use for deserialization (to preserve constructors). Your link.xml should look smth like this:
<linker>
<assembly fullname="Your.Dto.Package.Name" preserve="all" />
<assembly fullname="System.Core">
<type fullname="System.Linq.Expressions.Interpreter.LightLambda" preserve="all" />
</assembly>
</linker>
We use this library in all our projects for Android and iOS with IL2CPP and Mono runtimes.
Moreover, unlike Unity's JsonUtility, Newtonsoft.Json fully supports any type of objects, including Dictionary.
Microsoft Example
Newtonsoft Json fails AOT in iOS and also fails at deserializing anything inheriting from KeyedCollection in the webplayer. Here's a version that has been fixed:
JSON .NET For Unity (Supports iOS)
We use MiniJson and so far it serves our json needs well :)
I have been facing the same issue for a while and searched on every nook and cranny of the internet to look for a solution. Here's what worked for me.
I replaced NewtonSoft.Json with NewtonSoft.Json for Unity
Uninstalled NewtonSoft.Json from Unity's Nuget package manager.
Install NewtonSoft.Json for Unity with Unity's package manager. Follow this installation steps
What's the difference?
NewtonSoft.Json for Unity is different from standard NewtonSoft.Json
NewtonSoft.Json does not support AOT targets for IL2CPP builds in Unity
NewtonSoft.Json for Unity supports AOT targets such as all IL2CPP builds (WebGL, iOS, Android, Windows, Mac OS X) and portable .NET (UWP, WP8).
Hope this helps. Cheers!
Nope AFAIK.
LitJson and JsonFX would be alternate choice for Unity3D.
http://wiki.unity3d.com/index.php?title=UnityLitJSON
Have a look at the modified version of LitJson: UnityLitJson
Actually LitJson has some issues and is not always working as expected, so I created a simple JSON-Lib that can handle all Unity3D Types, Enums and arbitrary classes. Find it at GitHub: Tiny-JSON
You can use it very simple:
// encode
Animal a = new Animal(4);
string json = Json.Encode(a);
// decode
IList<Animal> a = Json.Decode<IList<Animal>>("[{\"legs\":4}, {\"legs\":2}]");
Yes, we share code on client and server and use an older version when it was called NewtonSoft.Json. Works in IOS, Android, everything.
Search for NewtonSoft.Json, and you could probably find an archive.
I am working on a project using Mono for Android. After reading a cross-platform document with Xamarin. I had my data layer in a separate project and was going to move it to my Mono for Android project and then link those files to my Mono Touch project, and one day perhaps a Windows Phone 8 project.
When I moved the code, I am now unable to compile because of the System.Xml.Linq reference. The reference shows in the Mono for Android project, but I am unable to use it. I thought aiming for Froyo may be the problem, but upgrading the project to Gingerbread or Ice Cream Sandwich didn't help.
Does anybody know what I am doing wrong? I am a seasoned .NET developer and am well aware of how references work in project, but this one has me stumped.
The project the original code was working on was targeting the Mono/.NET 4 framework
Is your reference to System.Xml.Linq pointing to the .Net version or the Mono version? The one for Mono will have Version 2.0.5.0.
Also, is the reference to System.Xml.Linq in a Android Class Library/Application or in a regular .Net Class library. If it is a .Net Class library, I would try referencing the library in your Android application as a compiled (dll) reference and not a project reference. It is not a perfect solution, but I have found that this works when I needed to reference libraries that I use across multiple solutions. The reference will generally work out fine, but if there is anything that is not supported in the Mono version, then it can cause issues.
Assuming you have your code in a class library, your best bet may be to create a Mono specific version of your library project. You can import and use the same class files, but just add some Conditional compilation symbols to have it compile properly for Mono. If you are not familiar with this, take a look at how Json.Net or ServiceStack manages code for multiple platforms.