In-Loco-Media / inlocomedia-android-sdk

In Loco Media Android SDK Repository
http://www.inlocomedia.com/publisher
11 stars 3 forks source link

Issue with NativeAd #4

Closed douglasiacovelli closed 8 years ago

douglasiacovelli commented 8 years ago

I'm trying to use the nativeAd solution in my app using the xml inside one of my activity's layout like the wiki explains:

<in.ubee.api.ads.AdView
                    android:id="@+id/ads"
                    style="@style/UBNativeAd"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:ubLoadOnAttach="true"
                    app:ubAdType="native_small" />

I've even tried to use native_large, however the result was the same. The exception given is: AdView.loadAd() failed. Invalid request with error: AdvertisementRequestException: Advertisement request has failed: java.lang.NullPointerException: Argument 'NativeAd View Title TextView' cannot be null

Thank you

falconegabriel commented 8 years ago

Hello Douglas,

This error means that there is a missing component on the NativeAd layout. It is necessary to include the elements shown on the documentation.

I have updated the documentation to include it on the example code to avoid this kind of misunderstanding.

Example:

<?xml version="1.0" encoding="utf-8"?>
<in.ubee.api.ads.AdView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    style="@style/UBNativeAd"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:ubAdType="native_large" >

    <!--Include your Ad Layout here. You can use the one bellow as an example-->

    <include layout="@layout/ub_native_large"/>

</in.ubee.api.ads.AdView>

You can check the updated documentation for additional information

douglasiacovelli commented 8 years ago

Solved! Thank you, Gabriel!