Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

It is possible to implement Unity Ads in Xamarin Android Project?

ephramdephramd ESMember ✭✭

I've been struggling with this problem for 1 week and it seems impossible...

The procedure should be:
1. Download unity-ads.arr (github.com/Unity-Technologies/unity-ads-android/releases)
2. Import the .arr (SDK) to our project.
2.1 We created a "Bindings Library (Android)" project in our solution.
**2.2 We add the .arr file to the "Jars" directory, in the "Build Action" file property we select "LibraryProjectZip" and compile.
**3. In our Android project we add the reference of the compiled project and we could already use the Unity object etc.

But step 2.2, compiling the Unity SDK, does not work...
Give the following error:

The type 'FailedEventArgs' already contains a definition for 'p0'
The type 'FailedEventArgs' already contains a definition for 'P0'
The type 'FailedEventArgs' already contains a definition for 'p1'
The type 'FailedEventArgs' already contains a definition for 'P1'

**Any ideas?
**
This is the only information found from the implementation:
youtube. com/watch?v=bZiRlrdieXY
Another thread of this forum where nobody receives an answer:
forums.xamarin. com/discussion/87927/add-unity-ads-adapter-for-admob (Ask for UnityAds and answer about Admob ..)

Tagged:

Answers

  • I ran into this problem also and got it to work. I'm using UnityAds 3.3 and Xamarin.forms 4.1, so it works for Android and iOS. Using Visual Studio 2019....
    Just click on those error messages and fix the bugs in the Unity code. Namely:
    in IResolveHostListener.cs, paste this in place of FailedEventArgs...

    `
    public partial class FailedEventArgs : global::System.EventArgs {

        public FailedEventArgs (string p0, global::Com.Unity3d.Services.Core.Request.ResolveHostError p1, string p2 = "")
        {
            this.p0 = p0;
            this.p1 = (string) p1;
            this.p2 = p2;
        }
    

    // ...deleted p0 and p1

        string p2;
        public string P2 {
            get { return p2; }
        }
    }`
    
Sign In or Register to comment.