Don’t forget to add dependencies to your NuGet packages

Yauheni Pakala
1 min readJan 3, 2021

A story with a happy ending that will save you time.

If you are using Karamunting.Android.TntKhang.FullScreenImageView (v1.1.1) library you can get the problems — some exceptions:

Exception 1 — NullPointerException

Unable to start activity ComponentInfo{com.example.superapp/com.github.tntkhang.fullscreenimageview.library.FullScreenImageViewActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference

Solution:

Use the right declaration to run the library:

var context = CrossCurrentActivity.Current.Activity; // used CurrentActivity pluginvar list = new string[] { "image-url1", "image-url2" };
var startIndex = 1;
var fullImageIntent = new Intent(context, typeof(FullScreenImageViewActivity));
fullImageIntent.PutStringArrayListExtra(FullScreenImageViewActivity.UriListData, list);
fullImageIntent.PutExtra(FullScreenImageViewActivity.ImageFullScreenCurrentPos, startIndex);
context.StartActivity(fullImageIntent);

Exception 2 — NoClassDefFoundError

Java.Lang.NoClassDefFoundError: Failed resolution of: Lcom/bumptech/glide/Glide; ---> Java.Lang.ClassNotFoundException: Didn't find class "com.bumptech.glide.Glide" on path: DexPathList[[zip file "/data/app/com.example.app/base.apk"],nativeLibraryDirectories=[/data/app/com.example.app/lib/x86, /data/app/com.example.app/base.apk!/lib/x86, /system/lib, /vendor/lib]]

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/bumptech/glide/Glide;
at com.github.tntkhang.fullscreenimageview.library.ImageFragment.onCreateView(ImageFragment.java:36)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2439)
...

Solution:

The author of the library didn’t include as dependencies Glide library. In this case, you will spend some time to find the right library or binding your own library of Glide.

Instead, you can find ready to use Glide binding library by the same author:

Just install an additional NuGet package Karamunting.Android.BumpTech.Glide.

End;

--

--

Yauheni Pakala

I’m a software engineer. I’m a fan of technology, web development, and programming.