简体   繁体   中英

Java.Lang.NoClassDefFoundError on extending DataMediaSource

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
            {
                 get
                 {
                      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();
            }
     }

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

I tried it to run on android 4.1, 4.4 and 5.1.1 but got the same result.

Exception screenshot on android 4.1

Exception screenshot on android 5.1.1

Now with the release of API 23, Android allows you to create a class that derives from MediaDataSource

Your devices are lower API level than required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM