0

I have an Xamarin.Android with the activity marked as MainLauncher called Login.

When I press F5 for first time the app starts ok in the emulator. Then I stop, do some code change, press F5 again I can see the app starting in the emulator and it's UI starting to show when I get this:

Java.Lang.RuntimeException: Unable to instantiate activity ComponentInfo{MyApp.MyApp/md5b14ee1c038eed1ee5328e926d768294f.Login}: java.lang.ClassNotFoundException: Didn't find class "md5b14ee1c038eed1ee5328e926d768294f.Login" on path: DexPathList[[zip file "/data/app/MyApp.MyApp-1/base.apk"],nativeLibraryDirectories=[/data/app/MyApp.MyApp-1/lib/x86, /vendor/lib, /system/lib]]

Then I will get this error on all attempts to start it. The only solution is to delete the bin and obj folders and press F5 again. After that the app will normally start once before I have to remove the folders again.

mrisek
  • 659
  • 1
  • 8
  • 25
Mathias Rönnlund
  • 4,078
  • 7
  • 43
  • 96
  • What version of Xamarin.Android are you using? https://stackoverflow.com/a/48039749/4984832 – SushiHangover Jan 24 '18 at 15:17
  • I'm using Visual Studio 2017 - v15.5.4. I should also add that the same problem occurs both when using an emulator and a real device. – Mathias Rönnlund Jan 24 '18 at 15:28
  • 1
    That version is for Visual Studio, what version of Xamarin.Android do you have installed? – SushiHangover Jan 24 '18 at 15:30
  • @SushiHangover Xamarin.Android releases are tied to Visual Studio releases. For example in release notes - https://developer.xamarin.com/releases/android/xamarin.android_8/xamarin.android_8.1/#January_9th_2018_-_Xamarin.Android_8.1.3.0 you might see `This version is included in the Visual Studio 2017 version 15.5.3 release.` 15.5.4 does not have an updated Xamarin.Android release and thus the Xamarin.Android version in 15.5.3 is the latest available. – Jon Douglas Jan 24 '18 at 16:30
  • @JonDouglas True for a normal install, but I (and many I have worked with) install/update components from VS offline layouts, so the VS version does not always correspond to a Xamarin.XXX version. – SushiHangover Jan 24 '18 at 17:06
  • Just trying to point out that it is possible to coorelate a Visual Studio version to a specific Xamarin.Android version :) Just a friendly FYI – Jon Douglas Jan 24 '18 at 17:10

1 Answers1

1

This issue has been fixed and will be included in Visual Studio 15.5.5 or Visual Studio 15.6 Preview 3.

The respective Xamarin.Android version this fix is included in are Xamarin.Android 8.1.5.0 (Stable) and Xamarin.Android 8.2.0.6 (Preview)

Be on the look-out for this release as it will be available soon!

(If you need a workaround today, please follow the steps here: https://bugzilla.xamarin.com/show_bug.cgi?id=61073#c40)

Jon Douglas
  • 13,006
  • 4
  • 38
  • 51