草庐IT

android - Xamarin Droid App 启动时出现 NullReferenceException

coder 2023-12-16 原文

我在通过 Visual Studio 2015 启动 Xamarin Android 应用程序时遇到 NullReferenceException。

在我的主要 Activity 中离开 OnCreate() 后抛出它,但我不知道在哪里以及为什么。如何找到有关此错误的更多信息?

调试输出是这样的:

05-21 20:18:51.643 D/OpenGLRenderer(25574): Use EGL_SWAP_BEHAVIOR_PRESERVED: true
05-21 20:18:51.651 D/Atlas   (25574): Validating map...
Unhandled Exception:

System.NullReferenceException: Object reference not set to an instance of an object

Exception:

System.NullReferenceException: Object reference not set to an instance of an object

05-21 20:19:37.436 D/Mono    (25574): DllImport attempting to load: '/system/lib/liblog.so'.
05-21 20:19:37.436 D/Mono    (25574): DllImport loaded library '/system/lib/liblog.so'.
05-21 20:19:37.436 D/Mono    (25574): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
05-21 20:19:37.436 D/Mono    (25574): Searching for '__android_log_print'.
05-21 20:19:37.436 D/Mono    (25574): Probing '__android_log_print'.
05-21 20:19:37.437 D/Mono    (25574): Found as '__android_log_print'.
05-21 20:19:37.450 I/MonoDroid(25574): UNHANDLED EXCEPTION:
05-21 20:19:37.454 I/MonoDroid(25574): System.NullReferenceException: Object reference not set to an instance of an object
05-21 20:19:37.454 I/MonoDroid(25574):   at Xamarin.Forms.Platform.Android.KeyboardManager.HideKeyboard (Android.Views.View inputView, Boolean overrideValidation) [0x00000] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\KeyboardManager.cs:14 
05-21 20:19:37.454 I/MonoDroid(25574):   at Xamarin.Forms.Platform.Android.FormsApplicationActivity.OnPause () [0x00000] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\FormsApplicationActivity.cs:153 
05-21 20:19:37.455 I/MonoDroid(25574):   at Android.App.Activity.n_OnPause (IntPtr jnienv, IntPtr native__this) [0x00009] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Activity.cs:4046 
05-21 20:19:37.455 I/MonoDroid(25574):   at (wrapper dynamic-method) System.Object:5c198319-5b9a-4152-9518-5aa3ce7cab6e (intptr,intptr)
05-21 20:19:37.476 W/art     (25574): JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
An unhandled exception occured.

05-21 20:19:38.791 E/mono    (25574): 
05-21 20:19:38.791 E/mono    (25574): Unhandled Exception:
05-21 20:19:38.791 E/mono    (25574): System.NullReferenceException: Object reference not set to an instance of an object
05-21 20:19:38.791 E/mono    (25574):   at (wrapper dynamic-method) System.Object:5c198319-5b9a-4152-9518-5aa3ce7cab6e (intptr,intptr)
05-21 20:19:38.791 E/mono    (25574):   at (wrapper native-to-managed) System.Object:5c198319-5b9a-4152-9518-5aa3ce7cab6e (intptr,intptr)
05-21 20:19:38.792 E/mono-rt (25574): [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
05-21 20:19:38.792 E/mono-rt (25574):   at (wrapper dynamic-method) System.Object:5c198319-5b9a-4152-9518-5aa3ce7cab6e (intptr,intptr)
05-21 20:19:38.792 E/mono-rt (25574):   at (wrapper native-to-managed) System.Object:5c198319-5b9a-4152-9518-5aa3ce7cab6e (intptr,intptr)
referenceTable GDEF length=670 1
referenceTable GSUB length=7202 1
referenceTable GPOS length=24560 1

最佳答案

我知道这已经有一段时间了,但也许我将来可以帮助别人。当我在应用程序启动时不小心删除了我的 App.Current.Mainpage 的启动时,类似的事情发生在我身上。导致无用错误消息的愚蠢错误。

从这里了解到我的问题出在哪里:https://bugzilla.xamarin.com/show_bug.cgi?id=36287

关于android - Xamarin Droid App 启动时出现 NullReferenceException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37366591/

有关android - Xamarin Droid App 启动时出现 NullReferenceException的更多相关文章

  1. ruby - ECONNRESET (Whois::ConnectionError) - 尝试在 Ruby 中查询 Whois 时出错 - 2

    我正在用Ruby编写一个简单的程序来检查域列表是否被占用。基本上它循环遍历列表,并使用以下函数进行检查。require'rubygems'require'whois'defcheck_domain(domain)c=Whois::Client.newc.query("google.com").available?end程序不断出错(即使我在google.com中进行硬编码),并打印以下消息。鉴于该程序非常简单,我已经没有什么想法了-有什么建议吗?/Library/Ruby/Gems/1.8/gems/whois-2.0.2/lib/whois/server/adapters/base.

  2. ruby - 在 64 位 Snow Leopard 上使用 rvm、postgres 9.0、ruby 1.9.2-p136 安装 pg gem 时出现问题 - 2

    我想为Heroku构建一个Rails3应用程序。他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres9.0。现在我需要一个postgresgem并且共识是出于性能原因你想要pggem。但是我对我得到的错误感到非常困惑当我尝试在rvm下通过geminstall安装pg时。我已经非常明确地指定了所有postgres目录的位置可以找到但仍然无法完成安装:$envARCHFLAGS='-archx86_64'geminstallpg--\--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/po

  3. ruby-on-rails - 启动 Rails 服务器时 ImageMagick 的警告 - 2

    最近,当我启动我的Rails服务器时,我收到了一长串警告。虽然它不影响我的应用程序,但我想知道如何解决这些警告。我的估计是imagemagick以某种方式被调用了两次?当我在警告前后检查我的git日志时。我想知道如何解决这个问题。-bcrypt-ruby(3.1.2)-better_errors(1.0.1)+bcrypt(3.1.7)+bcrypt-ruby(3.1.5)-bcrypt(>=3.1.3)+better_errors(1.1.0)bcrypt和imagemagick有关系吗?/Users/rbchris/.rbenv/versions/2.0.0-p247/lib/ru

  4. 使用 ACL 调用 upload_file 时出现 Ruby S3 "Access Denied"错误 - 2

    我正在尝试编写一个将文件上传到AWS并公开该文件的Ruby脚本。我做了以下事情:s3=Aws::S3::Resource.new(credentials:Aws::Credentials.new(KEY,SECRET),region:'us-west-2')obj=s3.bucket('stg-db').object('key')obj.upload_file(filename)这似乎工作正常,除了该文件不是公开可用的,而且我无法获得它的公共(public)URL。但是当我登录到S3时,我可以正常查看我的文件。为了使其公开可用,我将最后一行更改为obj.upload_file(file

  5. UE4 源码阅读:从引擎启动到Receive Begin Play - 2

    一、引擎主循环UE版本:4.27一、引擎主循环的位置:Launch.cpp:GuardedMain函数二、、GuardedMain函数执行逻辑:1、EnginePreInit:加载大多数模块int32ErrorLevel=EnginePreInit(CmdLine);PreInit模块加载顺序:模块加载过程:(1)注册模块中定义的UObject,同时为每个类构造一个类默认对象(CDO,记录类的默认状态,作为模板用于子类实例创建)(2)调用模块的StartUpModule方法2、FEngineLoop::Init()1、检查Engine的配置文件找出使用了哪一个GameEngine类(UGame

  6. ruby - 使用 postgres.app 在 rvm 下要求 pg 时出错 - 2

    我正在使用Postgres.app在OSX(10.8.3)上。我已经修改了我的PATH,以便应用程序的bin文件夹位于所有其他文件夹之前。Rammy:~phrogz$whichpg_config/Applications/Postgres.app/Contents/MacOS/bin/pg_config我已经安装了rvm并且可以毫无错误地安装pggem,但是当我需要它时我得到一个错误:Rammy:~phrogz$gem-v1.8.25Rammy:~phrogz$geminstallpgFetching:pg-0.15.1.gem(100%)Buildingnativeextension

  7. ruby-on-rails - 为什么在安装 Ruby 1.9.3 时出现 404 错误? - 2

    我最近对我的计算机(OS-MacOSX10.6.8)进行了删除,并且我正在重新安装我所有的开发工具。我再次安装了RVM;但是,它不会让我安装Ruby1.9.3。到目前为止我已经尝试过:rvminstall1.9.3rvm安装1.9.3-p194rvm安装1.9.3-p448rvminstall1.9.3--with-gcc=clang所有返回相同的命令行错误:Searchingforbinaryrubies,thismighttakesometime.Nobinaryrubiesavailablefor:osx/10.6/x86_64/ruby-1.9.3-p448.Continuin

  8. 安卓apk修改(Android反编译apk) - 2

    最近因为项目需要,需要将Android手机系统自带的某个系统软件反编译并更改里面某个资源,并重新打包,签名生成新的自定义的apk,下面我来介绍一下我的实现过程。APK修改,分为以下几步:反编译解包,修改,重打包,修改签名等步骤。安卓apk修改准备工作1.系统配置好JavaJDK环境变量2.需要root权限的手机(针对系统自带apk,其他软件免root)3.Auto-Sign签名工具4.apktool工具安卓apk修改开始反编译本文拿Android系统里面的Settings.apk做demo,具体如何将apk获取出来在此就不过多介绍了,直接进入主题:按键win+R输入cmd,打开命令窗口,并将路

  9. objective-c - 在设置 Cocoa Pods 和安装 Ruby 更新时出错 - 2

    我正在尝试为我的iOS应用程序设置cocoapods但是当我执行命令时:sudogemupdate--system我收到错误消息:当前已安装最新版本。中止。当我进入cocoapods的下一步时:sudogeminstallcocoapods我在MacOS10.8.5上遇到错误:ERROR:Errorinstallingcocoapods:cocoapods-trunkrequiresRubyversion>=2.0.0.我在MacOS10.9.4上尝试了同样的操作,但出现错误:ERROR:Couldnotfindavalidgem'cocoapods'(>=0),hereiswhy:U

  10. ruby-on-rails - 使用 Rails 2.3.5 运行 Thinking Sphinx 时出现问题 - 2

    我刚刚安装了Sphinx(发行版:archlinux)并下载了源代码。然后我为Rails安装了“ThinkingSphinx”插件。我关注了officialpagesetup和thisScreencastfromRyanBates,但是当我尝试为模型建立索引时,出现了这个错误:$rakethinking_sphinx:index(in/home/benoror/Dropbox/Proyectos/cotizahoy)Sphinxcannotbefoundonyoursystem.Youmayneedtoconfigurethefollowingsettingsinyourconfig/

随机推荐