Forum Xamarin Xamarin.Android

Integrate InMobi Ads within android

I am trying to integrate InMobi Ads in my app. Created a Java binding project with the necessary jars keep getting errors in one class.
Errors about "Invalid paramter type void", "Array type specifier must appear before param name" etc
Please see the attached Jars and ScreenShot. Appreciate help.


  • AtsushiEnomotoAtsushiEnomoto JPMember, Xamarin Team Xamurai
    edited April 2013
    I'm seeing different set of errors which is due to multi-method event listener (that is expected and user-level fix needed in metadata.xml), so my comment is rather from the remaining build warning - I see there is a warning output in the verbose build log:

    warning BG8800: Unknown parameter type java.lang.Void...
    found in method DoInBackground
    in type Com.Inmobi.Androidsdk.Impl.IMClickProcessingTask

    This means you have some instantiated generic parameters from AsyncTask.

    While it is possible to have java.lang.Void in parameters in Java, C# does not allow void there.

    To avoid this mismatch, you likely need to make changes for those parameters from void to e.g. Java.Lang.Object in Metadata.xml. I guess it is like:

    <attr path="/api/package[@name='com.inmobi.androidsdk.impl']/class[@name='IMClickProcessingTask']/method[@name='doInBackground']/parameter[@name=...]" name="type">java.lang.Object...</attr>

    (Please refer to our doc pages for Jar bindings, as well as check the API for the library.)

    By the way if you are seeing "void" instead of "Java.Lang.Void" it is likely that you are using some old version of Mono for Android. We don't have that "wrong" translation anymore, and you likely need to use newer Xamarin.Android.

  • AtsushiEnomotoAtsushiEnomoto JPMember, Xamarin Team Xamurai
    edited April 2013

    Actually with the latest alpha I investigated further and needed some different solution to get a project that builds.

    First, you need to rename some event args types using this Metadata.xml:

    Next, the DoInBackground() method issue needs to be fixed by additional C# source file (as doInBackground is not bound due to missing "Java.Lang.Void" type in managed land):

    using System;
    using Android.Runtime;
    namespace Com.Inmobi.Androidsdk.Impl
        public partial class IMClickProcessingTask
            static IntPtr method_dib_ref;
            protected override Java.Lang.Object DoInBackground (params Java.Lang.Object [] prms)
                method_dib_ref = method_dib_ref != IntPtr.Zero ? method_dib_ref : JNIEnv.GetMethodID (ThresholdClass, "doInBackground", "([Ljava.lang.Void)Ljava.lang.Void");
                JNIEnv.CallObjectMethod (ThresholdClass, method_dib_ref);
                return null;

    We might fix things in our binding generator so that this kind of use of Void could be resurrected, but so far please use this as a workaround.

  • shilpa.1055shilpa.1055 USMember

    Awesome!! Got latest xamarin android updates and used the above C# class. Thank you.

  • AhmerAhmer OMMember ✭✭

    I am also trying to integrate inmobi ads to my app.

    I followed the above steps and created a seperate JavaBindingLibrary project. When i compile i getting just 1 errors.

    Error 7 'Queuer': member names cannot be the same as their enclosing type d:\backup\my documents\visual studio 2010\Projects\inMobiAds\inMobiAds\obj\Debug\generated\src\Com.Inmobi.Androidsdk.Impl.Metric.Queuer.cs 30 66 inMobiAds

    Can you help please.


Sign In or Register to comment.