Bug 47337 - Java.Lang.NoClassDefFoundError during runtime
Summary: Java.Lang.NoClassDefFoundError during runtime
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.10.2
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: dean.ellis
Depends on:
Reported: 2016-11-18 08:40 UTC by Alik Khilazhev
Modified: 2017-08-23 20:34 UTC (History)
4 users (show)

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

Exception (24.46 KB, image/png)
2016-11-18 08:40 UTC, Alik Khilazhev
Android 5.1.1 (26.92 KB, image/png)
2016-11-18 09:28 UTC, Alik Khilazhev
Project zip (13.93 KB, application/zip)
2016-11-18 16:28 UTC, Alik Khilazhev

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Alik Khilazhev 2016-11-18 08:40:54 UTC
Created attachment 18527 [details]

I am trying to implement own MediaDataSource to decrypt videos on runtime. But I have a problem on very early stage: I just created class inherit it from MediaDataSource.
Here is the code:

class SimpleSource : Android.Media.MediaDataSource
        private string v;

        public SimpleSource(string v)
            this.v = v;

        public override long Size
                throw new NotImplementedException();

        public override int ReadAt(long position, byte[] buffer, int offset, int size)
            throw new NotImplementedException();

        public override void Close()
            throw new NotImplementedException();

But when I am calling var source = new SimpleSource("fname.ax"); it throws Java.Lang.NoClassDefFoundError in constructor.

Android version - 4.1 and 4.4
Comment 1 Alik Khilazhev 2016-11-18 09:28:23 UTC
Also tried on Android 5.1.1 and there is a more informative error. A will attach screen shot also.

Unhandled Exception:

Java.Lang.ClassNotFoundException: Didn't find class "md5f305099007d01e1849bb58437588d2f0.SimpleSource" on path: DexPathList[[zip file "/data/app/CRyptoMediaTest.CRyptoMediaTest-1/base.apk"],nativeLibraryDirectories=[/data/app/CRyptoMediaTest.CRyptoMediaTest-1/lib/x86, /vendor/lib, /system/lib]]
Comment 2 Alik Khilazhev 2016-11-18 09:28:59 UTC
Created attachment 18530 [details]
Android 5.1.1
Comment 3 Marek Habersack 2016-11-18 15:31:43 UTC
Could you please attach a small project that triggers the issue so that we can reproduce it locally?
Comment 4 Alik Khilazhev 2016-11-18 16:28:49 UTC
Created attachment 18538 [details]
Project zip

Attaching project.
Comment 5 Alik Khilazhev 2016-11-19 19:03:13 UTC
It seems that feature can be used only on android 6.0+:

Comment 6 dean.ellis 2016-11-21 11:58:25 UTC

So by targeting 6.0+ fix the issue? i.e setting the minimum sdk?
If so we can close this bug as FEATURE.
Comment 7 Cody Beyer (MSFT) 2017-08-23 20:34:22 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!