Bug 29631 - [MonoDroid] Java.Lang.ClassNotFoundException: Exception of type
Summary: [MonoDroid] Java.Lang.ClassNotFoundException: Exception of type
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries (show other bugs)
Version: 5.1
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2015-05-01 02:48 UTC by sunil.rana
Modified: 2017-10-04 16:24 UTC (History)
5 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description sunil.rana 2015-05-01 02:48:59 UTC
Hi,


     When i take stable update of xamarin studio 5.9,i  got thes error

Thanks,
Sunil Rana















Log ::
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Java.Lang.ClassNotFoundException: Exception of type 'Java.Lang.ClassNotFoundException' was thrown.
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00027>
[MonoDroid] at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <0x0002b>
[MonoDroid] at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () <0x0001b>
[MonoDroid] at Java.Lang.Thread/RunnableImplementor.Run () <0x00027>
[MonoDroid] at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <0x00034>
[MonoDroid] at (wrapper dynamic-method) object.896b6cca-ebde-40f8-9212-6c1a7b650e94 (intptr,intptr) <0x0001f>
[MonoDroid]   --- End of managed exception stack trace ---
[MonoDroid] java.lang.ClassNotFoundException: Didn't find class "naturevisiontv.android.NatureWindowActivity" on path: DexPathList[[zip file "/data/app/com.naturevisiontv-1/base.apk"],nativeLibraryDirectories=[/data/app/com.naturevisiontv-1/lib/x86, /vendor/lib, /system/lib]]
[MonoDroid] 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[MonoDroid] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
[MonoDroid] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
[MonoDroid] 	at mono.java.lang.RunnableImplementor.n_run(Native Method)
[MonoDroid] 	at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
[MonoDroid] 	at android.os.Handler.handleCallback(Handler.java:739)
[MonoDroid] 	at android.os.Handler.dispatchMessage(Handler.java:95)
[MonoDroid] 	at android.os.Looper.loop(Looper.java:135)
[MonoDroid] 	at android.app.ActivityThread.main(ActivityThread.java:5221)
[MonoDroid] 	at java.lang.reflect.Method.invoke(Native Method)
[MonoDroid] 	at java.lang.reflect.Method.invoke(Method.java:372)
[MonoDroid] 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
[MonoDroid] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
[MonoDroid] 	Suppressed: java.lang.ClassNotFoundException: naturevisiontv.android.NatureWindowActivity
[MonoDroid] 		at java.lang.Class.classForName(Native Method)
[MonoDroid] 		at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
[MonoDroid] 		at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
[MonoDroid] 		at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
[MonoDroid] 		... 11 more
[MonoDroid] 	Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.ClassNotFoundException: Exception of type 'Java.Lang.ClassNotFoundException' was thrown.
[mono-rt] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00027>
[mono-rt] at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <0x0002b>
[mono-rt] at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () <0x0001b>
[mono-rt] at Java.Lang.Thread/RunnableImplementor.Run () <0x00027>
[mono-rt] at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <0x00034>
[mono-rt] at (wrapper dynamic-method) object.896b6cca-ebde-40f8-9212-6c1a7b650e94 (intptr,intptr) <0x0001f>
[mono-rt] 
[mono-rt]   --- End of managed exception stack trace ---
[mono-rt] java.lang.ClassNotFoundException: Didn't find class "naturevisiontv.android.NatureWindowActivity" on path: DexPathList[[zip file "/data/app/com.naturevisiontv-1/base.apk"],nativeLibraryDirectories=[/data/app/com.naturevisiontv-1/lib/x86, /vendor/lib, /system/lib]]
[mono-rt] 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[mono-rt] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
[mono-rt] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
[mono-rt] 	at mono.java.lang.RunnableImplementor.n_run(Native Method)
[mono-rt] 	at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
[mono-rt] 	at android.os.Handler.handleCallback(Handler.java:739)
[mono-rt] 	at android.os.Handler.dispatchMessage(Handler.java:95)
[mono-rt] 	at android.os.Looper.loop(Looper.java:135)
[mono-rt] 	at android.app.ActivityThread.main(ActivityThread.java:5221)
[mono-rt] 	at java.lang.reflect.Method.invoke(Native Method)
[mono-rt] 	at java.lang.reflect.Method.invoke(Method.java:372)
[mono-rt] 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
[mono-rt] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
[mono-rt] 	Suppressed: java.lang.ClassNotFoundException: naturevisiontv.android.NatureWindowActivity
[mono-rt] 		at java.lang.Class.classForName(Native Method)
[mono-rt] 		at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
[mono-rt] 		at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
[mono-rt] 		at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
[mono-rt] 		... 11 more
[mono-rt] 	Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
[mono-rt]
Comment 1 asimk 2015-05-01 07:22:37 UTC
I have tried to reproduce this issue but not able to reproduce it. To reproduce this issue I have followed below steps:
1. Open XS on windows.
2. Update to stable XS 5.9.431 and XVS 3.11.445.
3. Create Android Application.
4. Build and run application.

When I build and run the application I am not getting any type of error. Please refer same as screencast: http://www.screencast.com/t/ZaR4cVsK30J

If you are still experiencing this issue, could you please provide us Ide log,
Environment info, Sample project. So we can reproduce this issue at our end.

You can get Ide log via XS-> Help-> Open Log Directory->ide.log
and Environment info via XS-> Help-> About-> Show Details-> Copy information. 

Environment info:
=== Xamarin Studio ===

Version 5.9 (build 431)
Installation UUID: 8226b5f6-953f-4809-8ea5-6bcbfe1bf80a
Runtime:
	Microsoft .NET 4.0.30319.0
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.26

=== Xamarin.Android ===

Version: 5.1.0 (Trial Edition)
Android SDK: C:\Program Files (x86)\Android\android-sdk
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
Java SDK: C:\Program Files (x86)\Java\jdk1.7.0_55
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) Client VM (build 24.55-b03, mixed mode)

=== Xamarin Android Player ===

Version: 0.3.7.2
Location: C:\Program Files\Xamarin Android Player\DeviceManager.exe

=== Build Information ===

Release ID: 509000431
Git revision: 7560726734fc7267de2fa9abed2509968deefaa8
Build date: 2015-04-17 17:09:09-04
Xamarin addins: 2e772c734ab3148054eae7bf8949f340fdeb5e5e

=== Operating System ===

Windows 6.2.9200.0 (64-bit)
Comment 2 sunil.rana 2015-05-01 07:34:21 UTC


It will reproduce in Release mode not in debug mode.

Detail for Xamrin Studio


Xamarin Studio
Version 5.9 (build 431)
Installation UUID: 426ebaed-95c2-4a1a-8a29-b4f2acc7f945
Runtime:
	Microsoft .NET 4.0.30319.18408
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.26

Xamarin.Android
Version: 5.1.0 (Enterprise Edition)
Android SDK: C:\Users\Sunil.Rana\AppData\Local\Android\android-sdk
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
java version "1.6.0_39"
Java(TM) SE Runtime Environment (build 1.6.0_39-b04)
Java HotSpot(TM) Client VM (build 20.14-b01, mixed mode, sharing)

Xamarin Android Player
Not Installed

Build Information
Release ID: 509000431
Git revision: 7560726734fc7267de2fa9abed2509968deefaa8
Build date: 2015-04-17 17:09:09-04
Xamarin addins: 2e772c734ab3148054eae7bf8949f340fdeb5e5e

Operating System
Windows 6.1.7601.65536 (64-bit)
Comment 3 Naqeeb 2015-05-01 10:47:57 UTC
I have checked this issue on 'Release' Mode but I am not able to reproduce it. The application build and run successfully on both 'Debug' and 'Release' mode without any error. Actually I am checking this issue with template application.
Are you getting this issue with any specific project?

Could you please provide us Ide log and Sample project. So we can reproduce this issue at our end.

You can get Ide log via XS-> Help-> Open Log Directory->ide.log

screencast: http://www.screencast.com/t/mujrdv9yi

Thanks!
Comment 4 Jonathan Pryor 2015-05-01 16:24:38 UTC
@sunil.rana: Please attach a repro.

This:

> java.lang.ClassNotFoundException: Didn't find class "naturevisiontv.android.NatureWindowActivity" on path: DexPathList[[zip file "/data/app/com.naturevisiontv-1/base.apk"],nativeLibraryDirectories=[/data/app/com.naturevisiontv-1/lib/x86, /vendor/lib, /system/lib]]
>     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)

Implies that "something" is attempting to load the type naturevisiontv.android.NatureWindowActivity, and that type doesn't exist.

That type presumably doesn't exist because:

1. XA 5.1 changed the "name mangling convention" for generated Java types which correspond to C# types:

http://developer.xamarin.com/releases/android/xamarin.android_5/xamarin.android_5.1/#Android_Callable_Wrapper_Naming

2. You're explicitly specifying the type naturevisiontv.android.NatureWindowActivity in a string.

As is often the case, type names within strings are brittle; they can cause breakage because of the linker, or because a type was renamed (for any number of reasons), etc. You should try to avoid them, and use constructs such as typeof() instead.
Comment 5 C Leitney 2017-05-17 10:04:25 UTC
thanks for fixing this bug..somehow my website http://dissertationwriter.org/ wasn't working because of it and have no idea why..anyways..now everything works perfectly..thanks
Comment 6 Jon Douglas [MSFT] 2017-10-04 16:24:17 UTC
I am marking this bug as RESOLVED ANSWERED based on the comment in https://bugzilla.xamarin.com/show_bug.cgi?id=29631#c4

If you are still encountering this issue, please reopen this bug with a reproduction project.

Note You need to log in before you can comment on or make changes to this bug.