Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Monodroid sliding menu

Has anyone imported this sliding menu project https://github.com/jfeinstein10/SlidingMenu in their Monodroid application?

I've imported the jar file (com.slidingmenu.lib.slidingmenuactivity.jar) in a new JavaLibraryProject.

I've created a new activity which extends from from SlidingActivity.

My project builds without any errors, but at runtime I get this exception

Java.Lang.NoClassDefFoundError: com.slidingmenu.lib.R$layout 

on

base.OnCreate(bundle)

public class MainActivity : SlidingActivity
{
    public override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);    //The EXCEPTION is thrown here
        SetContentView(Resource.Layout.activity_main);
    }

    public override void SetBehindContentView(int p0)
    {
        base.SetBehindContentView(p0);
    }        
}

Any ideas anyone? Thanks :)

EDIT

Ok. I've done a little modification:

I've added the "assets", "bin" and "res" folders to a ".zip" file which I've added in my AndroidJavaLibrary project.

It compiles fine, but now I get another error on the same line:

Android.Views.InflateException: Binary XML file line #2: Error inflating class com.slidingmenu.lib.SlidingMenu
like image 786
Mihai Avatar asked Oct 06 '22 23:10

Mihai


1 Answers

You need to include the Jar in both your Java Binding Library and your Mono for Android application. Just add a folder called libs to your Mono for Android project and copy the Jar file into that. You need to then set the build action to AndroidJavaLibrary.

So your solution should look like this:

  • Java Binding Library - The Jar file should be in the JarInputs folder and the build action should be InputJar
  • Mono for Android application project - Jar file should be in your libs folder and the build action set to AndroidJavaLibrary
like image 146
Alex Wiese Avatar answered Oct 10 '22 08:10

Alex Wiese