Native linking failed - Xamarin For Visual Studio - xamarin

I am trying to build an iOS app on windows visual studio using Xamarin For Visual Studio Trial. When compiling I am getting this error:
Error 136 MT5201:Native linking failed. Please review user flags provided to gcc: "-L/Users/brandon/Library/Caches/Xamarin/mtbs/builds/iCropTrak_vsios/9bc8504a-65b2-484f-b71c-1d0cb02d21f6" "-lgdal_x86" "-lc3dsqlite3" "-lstdc++" "-all_load" [K:\Development\AZSim\Products\CropTrak\iCropTrak_vsios.csproj]
0 0
It compiles fine on the mac - but having trouble getting it going with the windows version. Any ideas as to why?

Do you use {ProjectDir} in your project options ? If so you might be running into a current limitation where the directories won't match between platforms.
You should be able to workaround it, either by replacing {ProjectDir} or much better by using the [LinkWith] attribute.

You can bundle the Native reference inside a dll.
Take a look on this: http://forums.xamarin.com/discussion/comment/5371/#Comment_5371
and this:
https://github.com/viniciusjarina/NativeBindingVS
Thank you.

we discover this issue like two weeks ago, this only happens in simulator AFAIK. Seems that the dependency LevelDB left their Main symbol. I'll file a bug on Firebase. The workaround for this is to change the behavior of the Registrar on Simulator:
Open your project settings
Go to Build tab
Select iOS Build option
Type --registrar:static in Additional mtouch arguments textbox
Click on Ok
Don't forget to add this in Release and Debug configuration of iPhoneSimulator platform.

when i checked the source of the packages i found that they relies on
Xamarin.Build.Download
when i install the package problem resolved .

Related

Cannot build an installer for a CocoaApp (Xamarin.Forms) on Visual Studio for Mac

I have been trying to build a simple installer from a newly created template from Visual Studio for Mac.
New Project > Cocoa App
Nothing fancy really.
I can run the app in debug mode, but as soon as I enable the Create Installer Package option, it won't build.
Options > Build > Mac Build > Packaging : Create installer package (checkbox)
I always get this error:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.Common.targets(3,3): Error MSB6006: "productbuild" exited with code 134. (MSB6006) (InstallerAttempt01)
I am using the latest Visual Studio Mac, and the latest Xamarin.Forms versions.
So, I must be missing something, and I don't really know what right now, as I can't find any info on this topic anywhere.
Just to confirm that this is a bug, me and one more developer have confirmed it.
You can upvote or comment here so that it may be fixed quicker: https://github.com/xamarin/xamarin-macios/issues/13197
Update: Apple is expected to fix this problem in the new version of macOS/XCode

Building OpenCV-DNN module for 32-Bit UWP?

is it possible to build the OpenCV-DNN module for 32-Bit UWP? I cloned the official OpenCV repository and generated the VS-Projectfiles with the Generator "Visual Studio 14 2015" and set the flags -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0. However building for UWP will cause the dnn-module to not be included, so I changed the cmake files to include the module and I was able to build the binaries with Visual Studio.
Now here is the problem:
When I create a C++ UWP-Application, link the opencv_dnn.lib file, consume it and launch my app, I get the error:
"Unable to activate Windows Store app MYAPP. The MYAPP.exe
process started, but the activation request failed with error 'The app
didn't start'."
This happens for the debug and release configuration. If I link it, but don't use it at all in my code, I do not get the error. I looked the error up, but was not able to fix it.
Since the unmodified cmakefiles provided in the repo exclude the dnn-module when targeting UWP, I tought, that it is not possible to build this specific module.
Does anyone why this error would occur or if it is possible to build it with UWP as target? I did find this , which suggests that it is possible, although there bugs (not related to linking).
Thanks in advance.
Ok, so i figured it out. I did get the same error for every other opncv module. The problem was that Visual Studio didn't find the opencv dlls despite them being listed under the PATH env variable. I added the dlls to my project folder and was able to launch my program and use opencv.

Xamarin.Android.Common.targets: error : Could not find a part of the path '/platforms'

I am trying to debug this error from past 3 days but still unable to solve it. Hope anyone of you can help me and probably others in future.
Where its failing: Whenever I try to deploy the app, deployment fails, with this error:/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2112,3): error : Could not find a part of the path '/platforms'.
Though prior to this there are few warnings as well like,
AndroidManifest.xml //uses-sdk/#android:targetSdkVersion '21' is less than $(TargetFrameworkVersion) 'v7.0'. Using API-24 for ACW compilation
Some random conflicts.
But these are only warnings, and I shouldn't be concern about them.
What I did so far:
Uninstall/Install Visual studio
Tried downloading Xamarin studio through its dmg, thinking its IDE issue, but in vain.
Downloaded all relevant android sdk platforms.
Deleted/Again loaded the whole project.
but everything in vain. I will be highly thankful if anyone can help me in resolving this or atleast guiding me right direction.
Note: My visual studio version is 7.0.1, if this is of some help.
A more detailed error: /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Could not find a part of the path '/platforms'. at System.IO.__Error.WinIOError (System.Int32 errorCode, System.String maybeFullPath) [0x00207] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/io/__error.cs:188
Solved it myself:
Added the ndk path from Tools -> Add Custom tools -> SDK location -> Android. Look for ndk path, enter the same and run.
Thanks everyone for your help!
I found many people asking this same question, but very few answers.
First, if you get the error saying it can't find c:/platforms (or d:/platforms etc. depending on which drive the project is stored on.) it is probably because you don't have Android NDK installed. I thought this would have been installed with Xamarin, but - Nope.
In Visual Studio 2017, Navigate to Tools menu --> Options --> Xamarin --> Android Settings.
Notice the Andriod SDK Location and Andriod NDK Location. In my case, the NDK was blank.
I downloaded the NDK from https://developer.android.com/ndk/downloads/ and then unzipped it to "C:\Program Files (x86)\Android\android-ndk-r12b"
The problem is which version to download. At this time, version r19 Beta 2 is the current release, but a known bug in Xamarin causes this NDK to throw other errors when you try to archive. According to https://bugzilla.xamarin.com/show_bug.cgi?id=48678, Version r12b is the last version to work with Xamarin. Therefore it went to the NDK site, clicked on older versions, and choose the r12b 32bit version, downloaded, unzipped, and then saved that path in Tools menu --> Options --> Xamarin --> Android Settings-->Android NDK Location.
This solved many problems and allowed a successful Archive.
Go to:
Tools->Options->Xamarin->Android Settings
Changing Archives Location in settings worked for me.
The path of Android sdk location you are pointing to the project maybe changed.
Check in visual studio Tools->Option->Xamarin->Android settings
install ndk, then setting ndk path:Tools->Option->Xamarin->Android settings
this is my ndk path:C:\Microsoft\AndroidNDK64\android-ndk-r15c

Xamarin.Forms failed to compile android project with "Droid.Resource.Attribute" does not contain a definition for "actionBarSize"

I have a Xamarin.Forms project, and it worked just fine until I updated my Xamarin Studio Community to latest 5.10.3 (build 51) and updated Xamarin.Forms to 2.2.0.31
When I compile my android project, it showed me
"mynamespace.Droid.Resource.Attribute" does not contain a definition for "actionBarSize"
I did not change anything after upgrade and it works before, I know some others faced the same problem like me when I search on google, seems no one asked this in stackoverflow yet so I would like to get some help here.
If the above doesn't work try this
1) Delete Bin and Obj folders in project folder
2) Delete contents of C:\Users{your username}\AppData\Local\Xamarin\zips
3) Rebuild project
*This will take a while because xamarin will re-download the required files. it should work after its done.
That's a bug listed here. There are different workarounds about this, please try:
Failed to use Android Support Library v4
Creating a Hello World in Visual Studio with Xamarin Forms Fails
Xamarin cross-platform (portable class) project compilation error

Update the reference from Microsoft.Phone.WinJS.2.1, version 1.0.9651.0 to version 1.0.9651.40228

I was building/deploying my Windows Phone app in Visual Studio Professional 2013 with Update 3. The following console output showed up:
1>------ Build started: Project: CapturingVideos, Configuration: Debug ARM ------
2>------ Deploy started: Project: CapturingVideos, Configuration: Debug ARM ------
2>Deploying to Phone Internal Storage...
2>Creating a new clean layout...
2>Copying files: Total <1 mb to layout...
2>Checking whether required frameworks are installed...
2>Warning : DEP0810 : This app references Microsoft.Phone.WinJS.2.1, version
1.0.9651.0, found in your SDK, but you have a higher version of
Microsoft.Phone.WinJS.2.1 installed on the target machine, 1.0.9651.40228. If you
continue to run this application, it will run against the currently installed version,
Microsoft.Phone.WinJS.2.1, version 1.0.9651.40228. Consider updating your SDK to match
the version of Microsoft.Phone.WinJS.2.1 that is installed.
http://go.microsoft.com/fwlink/?LinkId=260891
2>Registering the application to run from layout...
I was curious about the Warning which suggested me to update the reference from WinJS.2.1 v1.0.9651.0 to v1.0.9651.40228. So I downloaded and installed the Visual Studio 2013 Extensions for the Windows Library for JavaScript. After restarting the OS and VS 2013, I tried to create a new Windows Phone project from the blank template. I expected the References folder to contain Windows Library for JavaScript 2.1 v1.0.9651.40228. However, it still only point to the old version, which was v1.0.9651.0. Was I on the wrong track or did I miss something? Please point me to the right direction. Thanks!
The issue is caused by wrong App Package Version number which is clearly displayed as 1.0.9651.0 in the reference properties despite all the .js and .css files the package contains have the correct build number 1.0.9651.40228 specified in their headers.
The App Package Version property takes its value from package's manifest file %Program Files%\Microsoft SDKs\WindowsPhoneApp\v8.1\ExtensionSDKs\Microsoft.Phone.WinJS.2.1\1.0\SDKManifest.xml particularly from the following line:
FrameworkIdentity="Name=Microsoft.Phone.WinJS.2.1, MinVersion=1.0.9651.0"
So tick the file's Read-only flag off, open it as an administrator and change the MinVersion number. Reload your solution. The warning message should disappear.
I had the same issue and found this blog post, along with your question here on StackOverflow:
http://blogs.msdn.com/b/lighthouse/archive/2014/04/21/can-t-update-visual-studio-2013-extensions-for-the-windows-library-for-javascript.aspx
I didn't have the issues your describing, or the issues warned about in the blog post, but they explained how to correct them with a powershell script.

Resources