locked
Debug deployment to Device works fine, Release fails with odd messages. Anybody have a fix for this? RRS feed

  • Question

  • User124644 posted

    Hello friends and neighbors. I am running Xamarin Studio latest version on OSX Mavericks. When attempting to deploy to a device (Android 4.1.2), the Debug configuration works fine, but a release configuration (which essentially removes the debug settings) fails and returns the following odd messages:

    [monodroid-assembly] Could not load assembly 'MyApp' during startup registration. [monodroid-assembly] This might be due to an invalid debug instalation. [monodroid-assembly] A common cause is to 'adb install' the app directly instead of doing from the IDE.

    There is a post from nearly a year and a half ago with the same results, but no resolution.

    Several questions, if we are to take these messages to heart.

    1. What is an "invalid debug installation" when attempting to perform a release build?

    There is no debug installation.

    (NOTE: I have completely removed all traces of the application from the device and reset, but I receive the same result)

    1. This might be due to an invalid debug instalation.

    See (1) above. And check your spelling.

    1. A common cause is to 'adb install' the app directly instead of doing from the IDE.

    This would not be a cause, but it might be a work-around ...

    Are we saying that "we don't know what we are doing, so our advice to you is to just bypass our code?" That doesn't instill much confidence in the platform ...

    Friday, May 29, 2015 2:34 PM

Answers

  • User138851 posted

    android options->cancel " use shared runtime "

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, July 7, 2015 2:21 AM

All replies

  • User101467 posted

    Same problem here after upgrading xamarin and Android SDK to the latest version.

    Xamarin Studio 5.9.3 Xamarin Android 5.1.3 java version "1.6.0_39" SDK Tools v24.3.1

    I didn't notice immediatly as my latest release was only a minor bugfix. Nothing changed to the profile/build settings. More info:

    it does work on some devices, like on my Galaxy Note 10, but randomly crashes or suddenly starts running very slow. on other devices like a galaxy S2 it crashes on strtup with the above error messages.

    I can't seem to downgrade to a previous version, so I'm currently stuck with a corrupted update-build

    Friday, June 5, 2015 10:02 AM
  • User16680 posted

    i have the same issue, for some reason (in my case) uninstalling the debug build directly from the device and then re-deploying the release build seems to do the trick

    (it also happens the other way around: once the release build is installed, i have the same crash if try to deploy the debug build, so i have to uninstall the release build and then redeploy. A bit annoying, but nothing game-breaking)

    Friday, June 5, 2015 2:41 PM
  • User101467 posted

    Unfortunately that is not the problem we are facing :(

    Friday, June 5, 2015 3:10 PM
  • User95386 posted

    uninstalling the debug build directly from the device

    Thanks aa1984.

    Friday, June 5, 2015 9:48 PM
  • User124644 posted

    Un-installling, redeploying, etc. does not work. This is a problem with the Xamarin infrastructure failing to determine the real issue and then "giving up", leaving the rest of us to chase down ghosts.

    Sometimes it's better to leave no error message at all than to create a misleading one

    Saturday, June 6, 2015 6:16 PM
  • User101467 posted

    Can we get any indication if this is being looked at?

    Monday, June 8, 2015 7:00 AM
  • User101467 posted

    I made a minimal example solution (based on a xamarin forms template and nothing else) that fails on a Samsung GT-I9100 (API 16) with following message:

    [monodroid] Trying to load sgen from: /data/data/com.companyname.test/lib/libmonosgen-2.0.so [monodroid-gc] GREF GC Threshold: 46080 [monodroid-assembly] Could not load assembly 'test.Droid' during startup registration. [monodroid-assembly] This might be due to an invalid debug instalation. [monodroid-assembly] A common cause is to 'adb install' the app directly instead of doing from the IDE.

    This is without any extra code, so it seems clear to me that this is a xamarin problem and should be looked at.

    Monday, June 8, 2015 7:21 AM
  • User101467 posted

    The main problem seems to be the use of xamarin.forms. As soon as I add the xamarin.forms package to a normal android project the problems start.

    Monday, June 8, 2015 1:24 PM
  • User124644 posted

    FYI, this appears to be dependent on the particular device used. For me, it happens on a CASIO, but not on an LG

    Monday, June 8, 2015 6:39 PM
  • User40440 posted

    Hi,

    I have exactly the same problem since I updated to the latest Xamarin Studio version today.

    This is a big issue since we need to release an update of our application :-(

    Thanks, have a nice day

    Tuesday, June 9, 2015 12:57 PM
  • User18711 posted

    Happening with my old Samsung Galaxy SII (Android 4.0.3), but not with my Moto DROID RAZR (Android 4.1.2). We also have a report that an SII on Android 4.1.1 also is seeing this issue, so I think that @mr-incredible is right, it's device dependent.

    One interesting thing to note is that my SII is not showing the Mono Runtime in the list of applications (although I know for a fact it used to be in the list) even after multiple deploys of the app in Release. Deploying in Debug has the Mono Runtime show up again.

    Maybe this is a bug in Xamarin's "Detecting installed packages" functionality?

    Friday, June 12, 2015 4:14 PM
  • User101467 posted

    Definitely device related, we can only reproduce it on a galaxy sII (GT-I9100 API 16)

    Friday, June 12, 2015 4:19 PM
  • User71406 posted

    Same problem here. It was working well until today.. It's strange because I updated xamarin to latest version on friday and yesterday I ran in release mode ok. Today it crashes after the splash screen with the same error..

    Sunday, June 14, 2015 11:26 PM
  • User124644 posted

    device - and / or Android version related?

    Monday, June 15, 2015 1:27 AM
  • User71406 posted

    Xamarin Studio Version 5.9.3 (build 1)

    Xamarin.Android Version: 5.1.3.1

    Android device: Brand XION (Chinese I think) Android 4.4.2

    If on Android Build, on the release configuration I check "Enable developer instrumentation" it works, but it's not the idea.. Google play store gives an error that cannot upload apk with debug options. It's really annoying

    Monday, June 15, 2015 2:21 AM
  • User71406 posted

    After installing an old version of xamarin.android AND xamarin studio, it didn't worked. Reinstalled the new version again, and didn't worked. Always uninstalling the app, Mono Shared Runtime and Support Library from the device(if they were installed) and doing a clean build. Without more alternatives, I restored the device to factory settings and REMOVED ALL device data, then finally it worked with release configuration. So, apparently it isn't device/version related. I think Xamarin is leaving some trash on the device that causes the problem.

    Tuesday, June 16, 2015 3:08 AM
  • User71406 posted

    Ops, I forgot to add that I also updated the library Xamarin.Android.Support.v4 to the latest version too (specifically 22.2.0.0). I don't know if it was the factory reset or the library that made it work because I did at the same time. (I hope that the problem is the support library). Hope it helps someone.

    Tuesday, June 16, 2015 3:14 AM
  • User124644 posted

    Thanks Diego - I had tried all of that except updating the support library. Now I am in Hell for making that attempt ... will report results

    Joy ...

    Tuesday, June 16, 2015 6:51 PM
  • User71406 posted

    Did you updated from the android SDK manager first?

    Tuesday, June 16, 2015 7:04 PM
  • User124644 posted

    Nope, same issue. ;/

    Xamarin is really not up to prime time

    Tuesday, June 16, 2015 7:46 PM
  • User71406 posted

    Well, I think I found the cause. After running on debug, and going back to release mode the devil came with it. My solution was removing the "data" folder of the application on the internal storage. On my device it was located on: /Android/data/com.my.app.package.name

    Tuesday, June 16, 2015 10:42 PM
  • User77747 posted

    Could this have something to do with the Fast Assembly Deployment setting?

    Wednesday, June 17, 2015 9:42 PM
  • User33198 posted

    thanks @diego.suarez I had the same issue and cleaning "data folder of the application on the internal storage" worked for me.

    Thursday, June 18, 2015 9:32 PM
  • User46843 posted

    Any one find solution for this? I'm not able to install app on my device using release mode.

    Friday, June 26, 2015 6:52 PM
  • User138851 posted

    android options->cancel " use shared runtime "

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, July 7, 2015 2:21 AM
  • User176175 posted

    @huguodong , it worked!!

    Thursday, November 26, 2015 5:10 AM
  • User177770 posted

    @huguodong, tyvm!

    Monday, February 1, 2016 7:04 PM
  • User203065 posted

    I fix the issue disabling Fast Assembly Deployment setting.

    Thursday, March 10, 2016 11:10 AM
  • User129555 posted

    I'm having the issue with SyncFusion currently and Fast Assembly Deployment setting did not help::

    [monodroid-assembly] Could not load assembly 'Syncfusion.SfAutocomplete.XForms.Android' during startup registration. [monodroid-assembly] This might be due to an invalid debug instalation. [monodroid-assembly] A common cause is to 'adb install' the app directly instead of doing from the IDE.

    Friday, May 13, 2016 1:18 PM
  • User233744 posted

    Sorry to resurrect this thread, but I've been having this issue and the "shared runtime" fix doesn't work for me. I get the same error message as OP but in my case, I am unable to load System.configuration.dll. The deployment fails to a Nexus 4 (Lollipop) emulator and also to my Galaxy S5 (can't remember which OS version I'm on).

    Tuesday, July 12, 2016 3:50 PM
  • User227870 posted

    @huguodong +100

    Wednesday, January 11, 2017 2:48 PM
  • User297756 posted

    I'm having a similar issue with a Firebase Android App, while writing down some lines to enable reception of notifications from Microsoft Azure. In fact the problem is:

    02-24 09:41:58.605 F/monodroid-assembly( 2420): Could not load assembly 'Windows' during startup registration. 02-24 09:41:58.605 F/monodroid-assembly( 2420): This might be due to an invalid debug installation. 02-24 09:41:58.605 F/monodroid-assembly( 2420): A common cause is to 'adb install' the app directly instead of doing from the IDE.

    That 'Windows' assembly reference points at this location:

    C:\Program Files (x86)\Windows Phone Kits\8.1\References\CommonConfiguration\Neutral\Windows.winmd

    Friday, February 24, 2017 8:44 AM
  • User335864 posted

    @KasperBorys said: Sorry to resurrect this thread, but I've been having this issue and the "shared runtime" fix doesn't work for me. I get the same error message as OP but in my case, I am unable to load System.configuration.dll. The deployment fails to a Nexus 4 (Lollipop) emulator and also to my Galaxy S5 (can't remember which OS version I'm on).

    @KasperBorys Did you manage to solve this?

    Tuesday, July 11, 2017 8:23 AM
  • User257249 posted

    I was struggling with this issue for a few days and it fixed itself after I updated my android SDK's. Probably should have thought of that first. Check those and see if they are behind.

    Friday, July 28, 2017 11:16 AM
  • User367631 posted

    04-21 17:17:26.302 D/Mono (17547): Assembly Loader probing location: 'System.Security.Permissions'. 04-21 17:17:26.302 F/monodroid-assembly(17547): Could not load assembly 'System.Security.Permissions' during startup registration. 04-21 17:17:26.302 F/monodroid-assembly(17547): This might be due to an invalid debug installation. 04-21 17:17:26.302 F/monodroid-assembly(17547): A common cause is to 'adb install' the app directly instead of doing from the IDE.

    hello, please i am having the same problem, my started after i connected to mysql and wrote down code to insert data into the database.

    Saturday, April 21, 2018 10:32 AM