New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VS 16.6.0 Prev 2.0 App crashes while displaying splash screen #4471
Comments
@grendello Just tried your suggestion. Exactly the same error again. Any other ideas? |
@gmck not really. What you're seeing is a result of mixing two different versions of XA. The property the exception cannot find was added to Xamarin.Android in this commit and your build somehow mixes "the old" with "the new" - thus the suggestion to clear |
@grendello I deleted both the bin and the obj directory. Neither existed when I rebuilt. Same error. I repeated it and did it all over again. Same result. Looks like exactly the same as in Issue 4472. |
@gmck I've just ran tests on two different systems (Linux and mac) with apps built from scratch and had no problem with them running on device. My diagnosis still stands - maybe in your case is a cross between the VS Stable and VS Preview installations? @jonathanpeppers might be able to help you more as he works on Windows with VS |
@grendello This app has never seen any version of VS stable, its a prototype, only with new stuff. You have the app, please try it. What is the point of asking for reproducible examples if you don't look at them? It was also sent to @jonathanpeppers. Thanks for reopening the issue and the improved subject heading. |
@gmck do you have VS Stable and VS Preview installed side-by-side? |
I tried the app, and both versions of VS worked for me:
I deleted the If I get this far, it worked? |
The problem you're seeing is caused by two different versions of Xamarin.Android ending up in a single .apk - to be exact, Java.Interop.dll in the apk is too old for the Xamarin.Android version. And, indeed, if you look inside your
Which points to a location of the stable Xamarin.Android installation, not the preview one. If, for some reason, that version of the dll is resolved first and placed in the apk with the preview version of Xamarin.Android you will end up with precisely the error message you're seeing. Please remove |
Yes, both machines have VS Stable and VS Preview side-by-side. Both machines don't necessarily run the same versions, I'm not that brave. Where are you going with this? |
Please see the comment above yours |
@gmck if you uninstall the app does that fix anything? My steps here did that: #4471 (comment) |
@grendello Sorry for the slow reply, but I was sleeping. Deleted the 3 directories built/deployed and exactly the same error. I've never even considered the .vs folder and have no knowledge of what it is meant to do. I get what you are saying but don't understand how or what made that situation come about. It would be good to know for possible problems in the future. Prior to deleting it, I could see the file storage.ide, but I've no idea of how you are meant to open it. After rebuilding and deploying there is just a v16 folder under the obdnowproto folder and it contains a .suo file. Now, no storage.ide file. Is that expected? Prior to doing the upgrade I was working on changing the theme to using MaterialComponents, some problems there and I was working on fixes for each problem as I came across them. I was building/deploying regularly all day with Preview 1 and it was fine. Didn't seem to have the usual problems I've been having re having to clean each time. Got to the end of the day, so I decided to run the upgrade and that was it. @jonathanpeppers certainly seems to have it running, but not me. I'm not sure how you want me to proceed. I don't think it is possible to go back to Preview 1 - seem to remember Brendan saying that to someone a few days ago. |
Can you just use 16.5 stable for now? |
@grendello @jonathanpeppers. This laptop with the problem project is only 10 days old and I've just upgraded the stable version to 16.5.1. I've just copied the project to another folder and it builds/deploys fine with 16.5.1. The .vs folder is as I described above. I went back to my older laptop and checked the .vs folder of the project there (dated 12/03). It does have Server/sqlite3/ folders and the storage.ide file, so I guess that is where that stuff came from. Can one of you explain or point to documentation re the Sql stuff and the .vs folder, would really like to know now. When I wake up again I'll uninstall the preview and then reinstall and see if I can copy the project back to the original folder. Sort of points to a stuff up in the installation. Since the older laptop still has Preview 1 I'll also copy to there and see if I can reproduce. Anything else you want me to try? Thanks for your help |
When you're "copying", are you bringing the I would make sure these are not getting passed/shared between two computers. |
@grendello, @jonathanpeppers, is Java.Interop.dll part of the shared platform APK when running in fast deployment mode? Given @jonathanpeppers's results with this same error on #4415 (comment), it sounded like perhaps the shared platform APK was not being rebuilt and redeployed as expected on the first try after a switching environments from Visual Studio 2019 version 16.6 Preview 1 to Visual Studio 2019 version 16.6 Preview 2. Is a stale shared platform APK on device a likely culprit? |
For my question about Java.Interop.dll, when using fast deployment:
Candidate workaround
The theory on the root cause of the problem would be that the Mono Shared Runtime package is not getting updated as expected, as seen before in #3784. |
Cross-references for the Xamarin.Android team:
|
I have now confirmed this theory. If I manually install the Mono Shared Runtime package from Xamarin.Android 10.2.100.7 to my device and then fast deploy an app using using Visual Studio 2019 version 16.6 Preview 2, I get the exception as mentioned in the issue description:
The candidate workaround of manually uninstalling Mono.Android.DebugRuntime successfully resolves the issue. (Deleting the bin, obj, and .vs directories and manually uninstalling the app APK does not resolve the issue, at least when using this custom technique to reproduce it.) |
@grendello, @jonathanpeppers, @brendanzagaeski, I can confirm that manually uninstalling Mono.Android.DebugRuntime, as suggested by Brendan, fixed the original problem of this report for Preview 2. The only thing in the .vs folder now is the .suo file. I'd appreciate your comments about how that folder got the original contents as reported by Marek. |
@jonathanpeppers Yes, that is how I've always copied a project from one folder to another. Whenever I zip a project for someone else I always delete the bin/obj folders before zipping, but that was a space-saving consideration. Are you saying the original copying technique is ok between folders on the same computer and that you only need the delete .vs, bin, obj folders when copying to another computer? |
@grendello, @jonathanpeppers, @brendanzagaeski, Further problems with this app. After adding a Fragment class from another app to this project, it was ok to start with, built and deployed ok. Now even with just the smallest of changes, I'm getting the following: System.NotSupportedException. Can't create an instance of type insert fully qualified fragment class name no java peer type found. This class was added as "add existing item" from a project already on this computer, so nothing to do with copying a project re @jonathanpeppers earlier question. Clean fixes it, until the next time. I thought I saw the "no java peer type found" in another issue, but now I can't locate it to check. Do you want this reported as a separate issue? |
Apologies for the slow reply about that symptom. In case any other user finds this issue first when searching for that error message, the item to follow for updates about that error message is #4415. |
@gmck can I ask what device you are using to test? We have had issues in the past where the I will try to dig out the command we send to see if you can invoke it manually on the device so we can see what is being returned. |
@dellis1972 , for what it's worth, I was able to reproduce with an Android 9.0 (API level 28) Google Pixel 3 device #4471 (comment). |
@brendanzagaeski do you have the deployment diagnostic log for that?
or something similar. The only way I can get the Install target to not replace the runtime is if it doesn't run. i.e It thinks the app is completely up to date and does not run the Install Target. |
@dellis1972 Sorry for the slow reply, I missed your question. Usual devices I deploy to are Pixel3a, Samsung S8 (Android 9) and Samsung S20 |
Root causeThe problem is that the Mono Shared Runtime From Xamarin.Android.Sdk-10.2.100.7.vsix:
From Visual Studio 2019 version 16.6 Preview 2:
If I'm reading the info from monodroid correctly, the reason the numbers are the same is that the
Since there haven't been any monodroid changes between these previews, the number hasn't changed. It looks like the fix might be to update mk/helper.mk so that |
Release status update A new Preview version of Xamarin.Android has now been published that includes a fix for this item, brought in by 2b9a019, that will prevent an outdated Mono Shared Runtime from being left on device between future Xamarin.Android version updates. The fix is not yet included in a Release version. I will update this again when a Release version is available that includes the fix. Fix included in Xamarin.Android 10.3.99.259. Fix included on Windows in Visual Studio 2019 version 16.7 Preview 2. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview. Fix included on macOS in Visual Studio 2019 for Mac version 8.7 Preview 2. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel. |
Release status update A new Release version of Xamarin.Android has now been published that includes the fix for this item. Fix included in Xamarin.Android SDK version 11.0.0.3. Fix included on Windows in Visual Studio 2019 version 16.7. To get the new version that includes the fix, check for the latest updates or install the most recent release from https://visualstudio.microsoft.com/downloads/. Fix included on macOS in Visual Studio 2019 for Mac version 8.7. To get the new version that includes the fix, check for the latest updates on the Stable updater channel. |
My prototype app which was uploaded a couple of days ago crashes at startup. It was cleaned, rebuilt and deployed and immediately just hung on the splash screen. Once the update was installed the only thing I noticed was that the layout screen that was opened when the installation began went through its compiling, rendering stuff and ultimately came up with an error reported previously that all the layouts of this app have displayed. So no difference there with the new Android Designer. I tried to debug but it crashed in the debugger immediately.
The only changes since I uploaded it to @jonathanpeppers and @grendello is that I've been changing the theme to use MaterialComponents.
The following is from the log as best as I could determine where the problem is.
2020-03-27 18:02:22.926 12838-12838/com.glmsoftware.obdnowproto D/Mono: Requesting loading reference 0 (of 2) of Mono.Security.dll
2020-03-27 18:02:22.926 12838-12838/com.glmsoftware.obdnowproto D/Mono: Loading reference 0 of Mono.Security.dll asmctx DEFAULT, looking for mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
2020-03-27 18:02:22.926 12838-12838/com.glmsoftware.obdnowproto D/Mono: Assembly Ref addref Mono.Security[0x7878f94780] -> mscorlib[0x790e4c6c00]: 5
2020-03-27 18:02:22.990 12838-12838/com.glmsoftware.obdnowproto E/mono: Unhandled Exception:
System.MissingMethodException: Method not found: void .CreationOptions.set_JniAddNativeMethodRegistrationAttributePresent(bool)
at Android.Runtime.AndroidRuntime..ctor (System.IntPtr jnienv, System.IntPtr vm, System.Boolean allocNewObjectSupported, System.IntPtr classLoader, System.IntPtr classLoader_loadClass, System.Boolean jniAddNativeMethodRegistrationAttributePresent) [0x00000] in :0
at Android.Runtime.JNIEnv.Initialize (Android.Runtime.JnienvInitializeArgs* args) [0x000ed] in :0
2020-03-27 18:02:22.990 12838-12838/com.glmsoftware.obdnowproto E/mono-rt: [ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: void .CreationOptions.set_JniAddNativeMethodRegistrationAttributePresent(bool)
at Android.Runtime.AndroidRuntime..ctor (System.IntPtr jnienv, System.IntPtr vm, System.Boolean allocNewObjectSupported, System.IntPtr classLoader, System.IntPtr classLoader_loadClass, System.Boolean jniAddNativeMethodRegistrationAttributePresent) [0x00000] in :0
at Android.Runtime.JNIEnv.Initialize (Android.Runtime.JnienvInitializeArgs* args) [0x000ed] in :0
2020-03-27 18:02:23.037 1429-10735/? I/ActivityManager: Process com.glmsoftware.obdnowproto (pid 12838) has died: fore TOP
The text was updated successfully, but these errors were encountered: