Cannot reference monotouch.dll when using SQLCipher? - xamarin

I have a Xamarin iOS project where I have just added SQLCipher to my packages. I now get a build error saying:
iOS/MTOUCH: Error MT0034: Cannot reference 'monotouch.dll' in a
Xamarin.iOS project - it is implicitly referenced by
'SQLite.Net.Platform.SQLCipher.XamarinIOS, Version=4.1.1.0,
Culture=neutral, PublicKeyToken=null'. (MT0034) (myProject.iOS)
I'm not sure how to fix this, I have tried deleting the sqlcipher package and adding again, rebuilding, and restarting Xamarin but no luck. Thanks for any help

Related

Can't resolve the reference 'System.UIntPtr System.nuint::op_Explicit(System.nuint)',Xamarin.Agora.AgoraRtcEngineKit

Trying to update Xamarin.Agora.iOS nuget updates (3.5.1-beta1) get this build time error:
error MT2101: Can't resolve the reference 'System.UIntPtr System.nuint::op_Explicit(System.nuint)', referenced from the method 'System.Int32 DT.Xamarin.Agora.AgoraRtcEngineKit::AdjustUserPlaybackSignalVolume(System.nuint,System.Int32)' in 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=xxxxx'.
Xamarin.forms version is latest: 5.0.0.2244
There's a couple of similar issues opened on the GitHub repo here:
https://github.com/AgoraIO-Community/Agora-RTC-SDK-for-Xamarin/issues/32
If you ping the maintainers of that repo they may be able to help

Failed to resolve assembly : 'Java.Interop'

When I try to build the application I get an exception the following exception :
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(681,3): error : Failed to resolve assembly: 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'
I tried cleaning the project and building it again, also updated the Xamarin.Forms packages but still with no luck.
A little overview on the stack trace :
2>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(681,3): error : Failed to resolve assembly: 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'
2> Tool /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch execution finished. (TaskId:153)
2> MTouch: 2016-07-05T14:27:15.8191415+05:30 - Finished (TaskId:153)
2> Output Item(s): _NativeLibrary= (TaskId:153)
2>Done executing task "MTouch" -- FAILED. (TaskId:153)
Has anyone received this error? I am running the latest Xamarin for Visual Studio.
As mentioned in the comments above by #SushiHangover Java.Interop.dll is from Xamarin.Android and I was getting an error in Xamarin.IOS.
I had a reference of Mono.Android in PCL which is always referenced in Xamarin.IOS so indirectly I was referencing dll of Xamarin.Android to Xamarin.IOS. Removing the reference from PCL solved my problem.
Step-by-step instructions on how to fish this one out, as it took me some time to find where the 'Android polluted' peace of code was.
Unload your Common code project
Open .csproj look for something like this
<ItemGroup>
<Reference Include="Mono.Android">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v11.0\Mono.Android.dll</HintPath>
</Reference>
Delete this segment from csproj.
Load the project
Clean and rebuild the solution having iOS as startup Project, at this point, you will get a build error that will show which .cs file fails to build due to missing reference.
Go there and move the mechanism to an Android specific project.
As mentioned by #AkashAmin 'Mono.Android' referenced should not be there in PCL project.
But with this, also make sure that you have not added any 'Android' specific code in PCL project by adding 'using Android', if this was done then you need to remove this code by using 'Dependency Services', Click here
I had the same problem and when I removed the android.mono reference from pcl project it worked fine.
I think it happens because we are building project in ios and it doesn't have any android libraries
Platform specific code within the Shared Project will cause iOS compiler to attempt to use the platform specific assemblies when compiling.
In my case, I had a reference within my Shared Project's code, within the "using" statements, which was causing iOS to attempt to link to Android specific assemblies.
Removing the code from the Shared Project allowed for successful compiling of the project.
Just in case, I got this error from working with ReSharper on VS2013 (https://bugzilla.xamarin.com/show_bug.cgi?id=41627).
What I did was use the Workaround to explicitly add java.interop.dll assembly to my project. This problem doesn't affect Build so you can deploy first and VS will download java.interop to your app's obj\Debug\linksrc folder, which you can reference...
You need to check your PLC project on Android link. In PLC project ctrl+f and lets go find "Android" and delete it.

LinkAssemblies fails after upgrading to MVVMCross 4.0

I have just updated a large Xamarin project from MVVMCross version 3.5 to 4.0. I have fixed all namespace issues and bugs, but I am stuck with this bug:
The "LinkAssemblies" task failed unexpectedly.
Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item
'System.Boolean Android.OS.BaseBundle::GetBoolean(System.String,System.Boolean)'
(defined in 'MvvmCross.Droid.FullFragging, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=null') from 'MvvmCross.Droid.FullFragging, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=null' could not be resolved. --->
Mono.Cecil.ResolutionException:
Failed to resolve System.Boolean Android.OS.BaseBundle::
GetBoolean(System.String,System.Boolean)
I have added MvvmCross.Droid.FullFragging.* to linkerConfig.xml, but to no avail.
I experienced the same issue. The MvvmCross dlls are build to version v6.0 for android. I noticed the following output tab (My logging is set to verbose).
warning XA0105: The $(TargetFrameworkVersion) for MvvmCross.Binding.Droid.dll (v6.0) is greater than the $(TargetFrameworkVersion) for your project (v5.0).
When I changed the projects to Android 6.0 I still received the linker error. When I opened the project file in a text editor I noticed that was defined twice. Once in the global property group set to 6.0 and once in the Debug property group set to 5.0. I removed the following line from the Debug property group and the issue went away.
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
What you need to do is to switch on verbose logging in your build. For iOS specify verbose logging by adding:
-v -v -v -v
To the extra build parameters textbox. Then run the build again.
For Android you can do this in the Visual Studio Tools -> Settings -> Xamarin -> Android settings -> Xamarin Diagnostics.
You will probably identify that some packages are of different versions and will cause this linking issue.
You will find some clues to the issue using verbose logging. I have only mentioned the verbose logging for this platform as its the platform I have most experience with at the moment.
This is the best answer I can offer as this issue can be caused by a truly massive number of issues and will be individual to each solution.

MSBuild fails on second stage using latest Mvvmcross 3.1.1 (nuget)

I have issue when building an Mvvmcross 3.1.1 (nuget) application. I am getting this exception during second phase build (packaging the apk) on my solution
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(970,5): error MSB4018: Xamarin.Android.XamarinAndroidException: error XA2006:
Reference to metadata item 'System.Void Android.Views.View::set_Activated(System.Boolean)' (defined in 'Cirrious.MvvmCross.Binding.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') from 'Cirrious.MvvmCross.Binding.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved.\r
This seems similar to this issue #629. While my manifest is ok:
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="15" />
I am using latest nuget Mvvmcross 3.1.1.
Thanks
That's probably due to the Linker on your Android project. Is Linking set on "Sdk and User Assemblies"? If yes: You need to compile with a higher Sdk version due to this bug. I hope the link may help you in case you want to keep the linker like that.

Error building project with XNAnimationPipline.dll and XNA3.1

I have a model with 2 animations, created in Blender and exported to fbx.
Referencing the XNAnimation.dll works, however when I reference the XNAnimationPipline.dll in the Content project I get a build error.
The "BuildContent" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'XNAnimationPipeline, Version=0.7.0.0, Culture=neutral, PublicKeyToken=0c21691816f8c6d0' or one of its dependencies.
The system cannot find the file specified.
File name: 'XNAnimationPipeline, Version=0.7.0.0, Culture=neutral, PublicKeyToken=0c21691816f8c6d0'
I have recently upgraded to XNA3.1 and am using the latest XNAnimation library.
Any ideas?
Thanks
Rebuilding the source code sorts it out
This explains

Resources