Xamarin App在启动时立即关闭

时间:2017-04-13 17:04:31

标签: android xamarin visual-studio-2017

您好我已经使用xamarin工具安装了 VS studio 2017社区并创建了一个新的Android项目。当我尝试启动应用程序时,它立即打开并关闭(眨眼间)并且不会出现错误。 我使用Android设备监视器来查看问题是什么,我得到了这个

 04-13 17:50:41.162: E/AndroidRuntime(16229): Process: xApp1.xApp1, PID: 16229
 04-13 17:50:41.162: E/AndroidRuntime(16229): java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider: java.lang.RuntimeException: 
 Unable to find application Mono.Android.DebugRuntime!
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at android.app.ActivityThread.installProvider(ActivityThread.java:5536)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at android.app.ActivityThread.installContentProviders(ActivityThread.java:5106)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5031)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at android.app.ActivityThread.access$1500(ActivityThread.java:185)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1628)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at android.os.Handler.dispatchMessage(Handler.java:111)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at android.os.Looper.loop(Looper.java:194)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at android.app.ActivityThread.main(ActivityThread.java:5847)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at java.lang.reflect.Method.invoke(Native Method)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at java.lang.reflect.Method.invoke(Method.java:372)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1010)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
 04-13 17:50:41.162: E/AndroidRuntime(16229): Caused by: java.lang.RuntimeException: Unable to find application Mono.Android.DebugRuntime!
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:47)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at android.app.ActivityThread.installProvider(ActivityThread.java:5533)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   ... 11 more
 04-13 17:50:41.162: E/AndroidRuntime(16229): Caused by: android.content.pm.PackageManager$NameNotFoundException: Mono.Android.DebugRuntime
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:296)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:41)
 04-13 17:50:41.162: E/AndroidRuntime(16229):   ... 12 more

2 个答案:

答案 0 :(得分:1)

尝试以下方法:

  1. adb uninstall Mono.Android.DebugRuntime

  2. adb uninstall Mono.Android.Platform.ApiLevel_X

  3. adb shell pm list packages -f(其中X是API级别)

  4. 这应该将您的环境设置为新状态,并且重新部署应该有效。如果您需要获取软件包列表以查看安装了哪个API级别,请使用/usr/local/bin/node /Users/talain/development/gitClone/enterprise/Source/clients-root/clients-webui-root/clients-webui-interface/node_modules/grunt-cli/bin/grunt --gruntfile /Users/talain/development/gitClone/enterprise/Source/clients-root/clients-webui-root/clients-webui-interface/Gruntfile.js "testing:start webdriver" Running "execute:start_webdriver" (execute) task -> executing /Users/talain/development/gitClone/enterprise/Source/clients-root/clients-webui-root/clients-webui-interface/node_modules/webdriver-manager [10:49:13] I/start - java -Dwebdriver.chrome.driver=/Users/talain/development/gitClone/enterprise/Source/clients-root/clients-webui-root/clients-webui-interface/node_modules/webdriver-manager/selenium/chromedriver_2.29 -Dwebdriver.gecko.driver=/Users/talain/development/gitClone/enterprise/Source/clients-root/clients-webui-root/clients-webui-interface/node_modules/webdriver-manager/selenium/geckodriver-v0.15.0 -jar /Users/talain/development/gitClone/enterprise/Source/clients-root/clients-webui-root/clients-webui-interface/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.3.1.jar -port 4444 [10:49:13] I/start - seleniumProcess.pid: 8081 10:49:13.978 INFO - Selenium build info: version: '3.3.1', revision: '5234b32' 10:49:13.979 INFO - Launching a standalone Selenium Server 2017-04-13 10:49:14.002:INFO::main: Logging initialized @277ms to org.seleniumhq.jetty9.util.log.StdErrLog 10:49:14.062 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC 10:49:14.062 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped: registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC 10:49:14.062 INFO - Driver class not found: com.opera.core.systems.OperaDriver 10:49:14.062 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped: Unable to create new instances on this machine. 10:49:14.063 INFO - Driver class not found: com.opera.core.systems.OperaDriver 10:49:14.063 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered 2017-04-13 10:49:14.106:INFO:osjs.Server:main: jetty-9.2.20.v20161216 2017-04-13 10:49:14.141:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@685cb137{/,null,AVAILABLE} 2017-04-13 10:49:14.174:INFO:osjs.AbstractConnector:main: Started ServerConnector@5bcab519{HTTP/1.1,[http/1.1]}{0.0.0.0:4444} 2017-04-13 10:49:14.175:INFO:osjs.Server:main: Started @450ms 10:49:14.175 INFO - Selenium Server is up and running

答案 1 :(得分:1)

我找到了解决办法 我的设备是魅族M2 Note,上面有flymeOs 5(android 5.1)。
由于它有2种模式:普通模式和访客模式,在调试时,应用程序会安装在两种模式下。所以我要做的就是登录访客模式并删除应用程序。