Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java.Lang.NoClassDefFoundError #4

Open
corne-du-plooy opened this issue Sep 19, 2022 · 0 comments
Open

Java.Lang.NoClassDefFoundError #4

corne-du-plooy opened this issue Sep 19, 2022 · 0 comments

Comments

@corne-du-plooy
Copy link

corne-du-plooy commented Sep 19, 2022

Hi Jonathan,

I am trying the slim bindings approach for Forms (5.0.0.2515) and have added the Xamarin.Binding.Helpers Nuget to both my Android Binding Library and to the .Android project as per the instructions. (VS for Mac - Tried 2019 and 2022)

I am using the latest version of the Mapbox library (10.8.0).

When I run the app it launches fine, but when my Custom Renderer tries to call the init of the Binding library I get the below exception:

{Java.Lang.NoClassDefFoundError: Failed resolution of: Lcom/mapbox/maps/MapView; ---> Java.Lang.ClassNotFoundException: Didn't find class "com.mapbox.maps.MapView" on path: DexPathList[[zip file "/data/app/com.test.mapboxtest-ggWWGq9F42iegDtVSeLtXA==/b…}

The error is thrown from the following line in the generated API Definition file:

_members.InstanceMethods.FinishCreateInstance (__id, this, __args);

The full method that is generated:

// Metadata.xml XPath constructor reference: path="/api/package[@name='com.test.mapboxwrapper']/class[@name='MapboxWrapper']/constructor[@name='MapboxWrapper' and count(parameter)=2 and parameter[1][@type='android.app.Activity'] and parameter[2][@type='com.test.mapboxwrapper.MapboxWrapperCallback']]"
		[Register (".ctor", "(Landroid/app/Activity;Lcom/test/mapboxwrapper/MapboxWrapperCallback;)V", "")]
		public unsafe MapboxWrapper (global::Android.App.Activity activity, global::Com.test.Mapboxwrapper.IMapboxWrapperCallback @callback) : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer)
		{
			const string __id = "(Landroid/app/Activity;Lcom/test/mapboxwrapper/MapboxWrapperCallback;)V";

			if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero)
				return;

			try {
				JniArgumentValue* __args = stackalloc JniArgumentValue [2];
				__args [0] = new JniArgumentValue ((activity == null) ? IntPtr.Zero : ((global::Java.Lang.Object) activity).Handle);
				__args [1] = new JniArgumentValue ((@callback == null) ? IntPtr.Zero : ((global::Java.Lang.Object) @callback).Handle);
				var __r = _members.InstanceMethods.StartCreateInstance (__id, ((object) this).GetType (), __args);
				SetHandle (__r.Handle, JniHandleOwnership.TransferLocalRef);
				_members.InstanceMethods.FinishCreateInstance (__id, this, __args);
			} finally {
				global::System.GC.KeepAlive (activity);
				global::System.GC.KeepAlive (@callback);
			}
		}

I can see the "package.targets" file is generated in "obj/debug/xbh" and all the aar's are copied to the "artefacts" subdirectory

any pointers on how to resolve this would be greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant