Just created a Xamarin.Forms app in Xamarin Studio 5.2.1 using the Blank App (Xamarin.Forms Portable) template.
Made no code changes, built solution, attempted to run it on a connected Android device via right-click on my .Android project and choosing Run With.
Instead of deploying and starting the app, I get an error "Execution failed: Object reference not set to an instance of an object."
Has anyone run into this and figured out the problem?
Found https://bugzilla.xamarin.com/show_bug.cgi?id=21508 and inferred that no startup project set for the solution could be the cause of the exception.
Set my .Android project as startup project and all is well.
Related
I am trying to run the initial example apps generated by the Kotlin Multi Platform Mobile plugin in Android Studio. I followed these steps for my environment setup. The Android Simulator runs correctly, but the iPhone Simulator does not. The Run Configuration has the following error:
Error: Selected scheme "iosApp" does not support "iphonesimulator"
When I run the configuration (ignoring the error), the iPhone simulator does open and appears to load iOS, but it never loads the "Hello, iOS" application that is in Android Studio.
What would cause this?
Version Information:
macOS 12.2.1
Android Studio 2021.1.1 Patch 2
Xcode 13.3
I fixed it with the following method.
Please close the Android Studio.
Go to ~/Library/LaunchAgents/ folder and delete com.jetbrains.AppCode.BridgeService.plist there.
Launch Android Studio with the KMM plugin again. It should work now.
From my tests, it seems that there may be multiple reasons for which we receive this error:
the root folder of the ios project has a different name than the .xcodeproject file. Sometimes it works even if they are different and maybe it matters if we change this name after the frameworks was already connected to the iOS project.
"Other linker flags" were manually copied and they were not copied using the copy button from the Connect the framework to your iOS project. This results to wrong data like:
"$(inherited)",
"-framework",
"shared\n",
instead of
"$(inherited)",
"-framework",
shared,
I managed to fix this by going into Edit Configurations on Android Studio and choosing the location of my XCode project file again. I believe this is an error of the KMM plugin in Android Studio and has yet to be fixed.
Updating Android Studio and KMM plugin worked for me.
I have a solution with,
Xamarin.iOS project
NetStandard 2.0 project
The tools I use are,
Visual Studio for Windows 2019 (v 16.3.2)
Xamarin.iOS SDK (13.2.0.42)
I can successfully build the application. But it gives this error on launching for both the Device and the Simulator,
error MT1001: Could not find an application at the specified directory: /Users/myUser/Library/Caches/Xamarin/mtbs/builds/MyApp.iOS//bin/iPhoneSimulator/Debug/MyApp.app
When I checked the Xamarin.logs for more info, I see this,
Xamarin.Messaging.Ssh.SshCommandRunner|Warning|0|Failed to execute 'which mono64': ExitStatus = 1
How can I fix this?
You have to specify the Platform Target in a way to allow a x64 build.
Right click on the Xamarin.iOS project and selection Properties. In the Properties Window, under Build tab, select either Any CPU or x64 for the appropriate Configuration and Platform.
That's all 😊 Try to redeploy.
I'm working on Xamarin Forms application in Visual studio 2017 .I wanted to deploy application to android simulator .I try to deploy it debug mode.
i set android project as the startup project
When i deploying i get this warning
No Address and User has been specified in order to establish a connection to a Mac Server, so only the main assembly was compiled for project CMI.IOSApp. Connect to a Mac Server and try again to build the full application.
Go to VS menu Build->Configuration Manager is iOS project tick when you have set your android project as start up project.
So the Build and Deploy checkbox for iOS project should be untick when you are going for Android build.
I am the newbie in Xamarin Cross Platform development. I am using Visual Studio 2015 Preview for development. I created the new solution for mobile app and it is working correct for both Droid and Windows phone. But after successful connection with iOs Build host I got the error when I build the iOs App like -
Xamarin.iOS does not support running or debugging the previous build version of your project.Please ensure your solution builds before running or debugging it.
And also when I click on View iOS Simulator I got build host error.
Error: Build version problem. it will show the build version problem.
Please tell me the solution for this.
Most common cause of those symptoms
The most likely cause of this issue is the following known bug:
https://bugzilla.xamarin.com/show_bug.cgi?id=25811
Explanation
The problem in that bug is that the Xamarin.Forms template is using a bad default setting for the iOS project in Visual Studio's configuration manager.
The configuration manager works by telling Visual Studio which projects you want to be built and/or deployed at the same time in the configuration you're using at the time.
So for example; when you build your Android project in Forms, the configuration manager makes sure that the shared project is included; otherwise it wouldn't work, or you'd have to build it separately or etc. etc. (i.e. a real pain.)
Normally, Visual Studio doesn't have a way to automatically "know" which project(s) you want to include in all your configurations; you'd have to tell it to include (some library) with (some app); etc. manually.
How to fix it
Screencast: http://www.screencast.com/t/zLoQOpEn
Go to "Build -> Configuration Manager"
Select the configuration(s) you wish to adjust, (e.g. Debug | iPhoneSimulator, Release | iPhone)
Make sure your shared library project(s) are included with the platform-specific configurations. (You can ignore the greyed-out 'Deploy' checkboxes, those are handled automatically)
Why this is a bug
So this isn't a bug in that the configuration manager isn't working correctly for iOS projects, but that the Forms template is using a bad default setting for the iOS projects when you create a new app. It should "know" to include the shared project in the iOS configurations by default.
Anyone knows why I get the error message when debugging on emulator : "the application could not be launched for debugging. Ensure that the target device screen is unlocked and that the application is installed." while Developing in Visual Studio 2010.
I've Googled it through and try the solution, but still not fixed my problem.
Btw, my solution type is SLXNA so, there are 3 projects in there, the main project, lib project, and libcontent project.
What I've tried :
Set the main project as the startup project
Checked the build and deploy check box for the main project and checked the build checkbox for the lib project
Change active solution platform to Windows phone
Rebuild solution
But it's still didn't fixed the problem
But when I debug it on device, it runs smoothly
Anyone knows how to fix this?
Make sure that the project you want to run is set a default Startup
project
Make sure that in dropdown on top you have selected "Windows Phone
Emulator", not "Windows Phone Device"
And the most important is: click on an arrow pointing down near
the Debug/Release configuration and open Configuration Manager...
Make sure that the checkbox is checked in a column "Deploy" next
to your project name.
good news : i've solved this by simply installing the windows phone sdk 7.1.1
In case some WP8 developers stumble upon this:
I've seen the exact same error message on VS 2012 with a WP8 app. However, it worked when I switched to Visual Studio Express for Windows Phone (comes with the SDK).