Open linversion opened 1 week ago
Hi @linversion I tested the code snippet you shared and have not been able to reproduce the issue.
Could you reproduce the issue in our demo app and share a screenshot showing the issue you are seeing?
Hi @linversion I tested the code snippet you shared and have not been able to reproduce the issue.
Could you reproduce the issue in our demo app and share a screenshot showing the issue you are seeing?
Hi @NanaAmoah , here is how I reproduce the issue in kotlin demo app.
//app build.gradle
if (isLocalAppLovinWorkspace) {
implementation(project(":Android-SDK"))
} else {
implementation("com.applovin:applovin-sdk:12.5.0@aar")
}
create layout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
>
<ImageView
android:id="@+id/icon_image_view"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="6dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:contentDescription="icon" />
<FrameLayout
android:id="@+id/icon_content_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<FrameLayout
android:layout_width="26dp"
android:layout_height="15dp"
android:id="@+id/options_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
</FrameLayout>
<ImageView
android:id="@+id/ad_icon"
android:layout_width="27dp"
android:layout_height="18dp"
app:layout_constraintStart_toEndOf="@id/icon_image_view"
app:layout_constraintTop_toTopOf="@id/icon_image_view"
android:layout_marginStart="7dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/title_text_view"
tools:text="Test Ad: "
app:layout_constraintStart_toEndOf="@id/ad_icon"
app:layout_constraintTop_toTopOf="@id/ad_icon"
app:layout_constraintBottom_toBottomOf="@id/ad_icon"
android:layout_marginStart="8dp"
/>
<TextView
android:id="@+id/advertiser_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toEndOf="@id/title_text_view"
app:layout_constraintTop_toTopOf="@id/title_text_view"
tools:text="Flood-it"
/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/body_text_view"
app:layout_constraintStart_toStartOf="@id/ad_icon"
app:layout_constraintEnd_toStartOf="@id/cta_button"
app:layout_constraintTop_toBottomOf="@id/ad_icon"
android:layout_marginTop="5dp"
tools:text="Text text tesxt texge tegn tejogne gegegn gegoentete tee nnn ted tedgn tete"
android:maxLines="2"
android:ellipsize="end"
android:layout_marginEnd="5dp"
android:textSize="11sp"
/>
<Button
android:layout_width="76dp"
android:layout_height="wrap_content"
android:id="@+id/cta_button"
android:text="GO"
android:background="@color/colorAccent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginEnd="8dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
3. build the binder
```kotlin
// ManualNativeLateBindingAdActivity
private fun createNativeAdView(): MaxNativeAdView {
val binder: MaxNativeAdViewBinder = MaxNativeAdViewBinder.Builder(R.layout.applovin_native_banner)
.setTitleTextViewId(R.id.title_text_view)
.setBodyTextViewId(R.id.body_text_view)
.setAdvertiserTextViewId(R.id.advertiser_text_view)
.setIconImageViewId(R.id.icon_image_view)
.setOptionsContentViewGroupId(R.id.options_view)
.setCallToActionButtonId(R.id.cta_button)
.build()
return MaxNativeAdView(binder, this)
}
the icon view can not show
but if i set the iconContentViewId by reflection
// ManualNativeLateBindingAdActivity
private fun createNativeAdView(): MaxNativeAdView {
val binder: MaxNativeAdViewBinder = MaxNativeAdViewBinder.Builder(R.layout.applovin_native_banner)
.setTitleTextViewId(R.id.title_text_view)
.setBodyTextViewId(R.id.body_text_view)
.setAdvertiserTextViewId(R.id.advertiser_text_view)
.setIconImageViewId(R.id.icon_image_view)
.setOptionsContentViewGroupId(R.id.options_view)
.setCallToActionButtonId(R.id.cta_button)
.build()
val iconContentViewId = binder.javaClass.getDeclaredField("iconContentViewId")
iconContentViewId.isAccessible = true
iconContentViewId.set(binder, R.id.icon_content_view)
return MaxNativeAdView(binder, this)
}
Thanks @linversion. Can you please share the project which reproduces the issue here?
@NanaAmoah bro I already said the project I used was the Applovin Max Demo App-Kotlin,just add your sdk key and native ad unit ID,follow the step I mentioned before
@linversion could you double check that you are setting the correct package name, SDK key and ad unit ID in the demo app?
A mismatch in your credentials will result in the issue you are seeing. To verify that you are using the correct package name and SDK key, tap "Launch Mediation Debugger". You should see your package name under "App Info" and all the ad unit IDs created for that app under "View Ad Units".
I am only able to reproduce your issue in our demo app with mismatched credentials so if after double checking, you are still reproducing the issue, please share the demo app project where the issue is reproducible here.
MAX SDK Version
12.5.0
Device/Platform Info
all device
Current Behavior
I'm trying to show my custom native ad template. But the icon will not show. Because in MaxNativeAdView's a() method, there's a logic assert this.h(which is the iconContentViewId cast to FrameLayout) not null, only if this.h != null will go in the setImageDrawable logic to this.g(the Icon ImageView) and the only way to set this iconContentViewId is MaxNativeAdViewBinder's setIconContentViewId which is protected
Expected Behavior
can show icon image view without setting iconContentViewId or provide a method to set it
How to Reproduce
Additional Info
No response