简体   繁体   English

当我创建新的Android应用程序(Visual Studio)时,对象引用未设置为对象的实例

[英]Object reference not set to an instance of an object When I create new Android App (Visual Studio)

In a Visual Studio 2015, Xamarin, Android SDK, jdk 1.7, and emulator are installed and Xamarin has all green checked items in tools>options>Xamarin. 在Visual Studio 2015中,安装了Xamarin,Android SDK,jdk 1.7和模拟器,Xamarin在工具>选项> Xamarin中包含所有绿色选中项。 But When I try to create Blank App (Android) VS shows an error: 但是当我尝试创建空白应用程序(Android)VS时显示错误:

Object reference not set to an instance of an object 你调用的对象是空的

Then new project fail to create and solution explorer will be empty. 然后新项目无法创建,解决方案资源管理器将为空。

How could I solve it? 我该怎么解决?

我在Visual Studio安装程序中使用更新的Android SDK设置(API级别19和21)[第三方]到Android SDK设置(API级别22)[第三方]解决了这个问题。

I had the same problem and when I installed Android 4.4.2(API 19) from Android SDK Manager the issue got resolved. 我遇到了同样的问题,当我从Android SDK Manager安装Android 4.4.2(API 19)时 ,问题得到了解决。 You can open Android SDK Manager in VS2015 with Update 2 by navigating to Tools-> Android->Android SDK Manager 您可以通过导航到Tools-> Android-> Android SDK Manager,在VS2015中使用Update 2打开Android SDK Manager

I figured out this... Depending on the emulators you want to use with the new project, subject to what is installed using Android AVD, you will need to download the necessary API Level. 我想出了这个......根据您想要与新项目一起使用的模拟器,根据使用Android AVD安装的内容,您需要下载必要的API级别。

Example. 例。 I looked up my emulators. 我查看了我的模拟器。 Then I simply opened Android SDK Manager and downloaded the corresponding API Level 19 然后我只需打开Android SDK Manager并下载相应的API Level 19

And everything worked out well 一切顺利

我也在使用Xamarin.VisualStudio_4.0.3.214在Visual Studio 2015 Update 2上遇到此问题,但我通过Android SDK Manager安装级别19,21,22,23解决了这个问题。

I struggle with this same problem for a whole day but I got it resolved after several iterations. 我整整一天都在努力解决这个问题,但经过几次迭代后我才解决了这个问题。

  1. Make sure Android Studio is not installed on your computer. 确保您的计算机上未安装Android Studio。 If it is, uninstall it and run the VS2015 installer again until all Android SDK errors go away. 如果是,请将其卸载并再次运行VS2015安装程序,直到所有Android SDK错误都消失为止。

  2. Make sure VS2015 is closed and install the most recent stable version of Xamarin for Visual Studio 2015. I found it here: https://store.xamarin.com/account/my/subscription/downloads . 确保VS2015已关闭,并为Visual Studio 2015安装最新的Xamarin稳定版本。我在此处找到它: https//store.xamarin.com/account/my/subscription/downloads (Trying to install it through VS2015 didn't work for me under Tools -> Android -> Settings -> Xamarin for Visual Studio Updates.) (尝试通过VS2015安装它对我来说不适用于工具 - > Android - >设置 - > Xamarin for Visual Studio更新。)

  3. Make sure you have Java SDK version 7 installed on your machine (do not use 8 even though its the latest). 确保您的计算机上安装了Java SDK版本7(即使它是最新的,也不要使用8)。 You also must use the 32-bit version even if you have a 64-bit machine. 即使您有64位计算机,也必须使用32位版本。 This was key! 这很关键!

  4. Install the Android SDK. 安装Android SDK。 Standalone version, not Android Studio + Android SDK. 独立版,而不是Android Studio + Android SDK。

  5. Install the Android NDK. 安装Android NDK。

  6. Restart your computer and open VS2015. 重新启动计算机并打开VS2015。 Go to Tools -> Android -> Settings and set the correct paths to Android SDK, NDK and Java SDK. 转到工具 - > Android - >设置,并设置Android SDK,NDK和Java SDK的正确路径。

  7. You should be good to go with creating a new project. 你应该好好创建一个新项目。 You are all welcome!!! 欢迎你!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试测试入门程序时,Visual Studio 2017 / Xamarin Android模拟器“对象引用未设置为对象的实例。” - Visual Studio 2017/Xamarin Android Emulator “Object reference not set to instance of an object.” when attempting to test starter program Xamarin Android应用程序无法正常工作(错误:未将对象引用设置为对象的实例) - Xamarin Android App not working (Error: Object reference not set to an instance of an object) 你调用的对象是空的。 安卓系统 - Object reference not set to an instance of an object. Android Xamarin.Forms应用程序可在iOS上运行,在Android上引发错误(“对象引用未设置为对象的实例”) - Xamarin.Forms app works on iOS, throws error on Android (“Object reference not set to an instance of an object”) 尝试从arraf填充fragmenrt上的Xamarin Android TextView时,对象引用未设置为对象的实例 - Object reference not set to an instance of an object when trying to populate Xamarin Android TextView on fragmenrt from arrary Xamarin.Forms Android对象引用未设置为对象的实例 - Xamarin.Forms Android Object reference not set to an instance of an object 初始化WebView Xamarin Android时,对象引用未设置为对象的实例 - Object reference not set to an instance of an object while initializing WebView Xamarin Android Android中的WebService错误。 你调用的对象是空的 - Error with WebService in Android. Object reference not set to an instance of an object Xamarin android System.NullReferenceException:未将对象引用设置为对象的实例 - Xamarin android System.NullReferenceException: Object reference not set to an instance of an object Xamarin Android KitKat对象引用未设置为对象的实例 - Xamarin Android KitKat Object reference not set to an instance of an object
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM