小编Meh*_*may的帖子

PlatformException(NativeAdError,在flutter原生广告上找不到带有id的NativeAdFactory(android)

我在 flutter 原生广告 (android) 上遇到此错误:

\n

PlatformException(NativeAdError, Can't find NativeAdFactory with id: homeScreen, null, null)

\n
google_mobile_ads: ^0.13.0\n
Run Code Online (Sandbox Code Playgroud)\n

这是我的 HomeScreenNativeAd.kt 文件

\n
class HomeScreenNativeAd(val context: Context) : GoogleMobileAdsPlugin.NativeAdFactory {\n\n    override fun createNativeAd(\n            nativeAd: NativeAd,\n            customOptions: MutableMap<String, Any>?\n    ): NativeAdView {\n        val homeScreenNativeView = LayoutInflater.from(context)\n                .inflate(R.layout.home_screen_native_ad, null) as NativeAdView\n\n        with(homeScreenNativeView) {\n            val attributionViewSmall =\n                    findViewById<TextView>(R.id.tv_home_item_native_ad_attribution_small)\n\n\n            val icon = findViewById<ImageView>(R.id.home_item_bg_image)\n\n\n            val image = nativeAd.icon\n            if (image != null) {\n                attributionViewSmall.visibility = View.VISIBLE\n                icon.setImageDrawable(image.drawable)\n            } else {\n                attributionViewSmall.visibility = View.INVISIBLE\n            }\n            this.iconView …
Run Code Online (Sandbox Code Playgroud)

android flutter google-ads-api

6
推荐指数
0
解决办法
1280
查看次数

标签 统计

android ×1

flutter ×1

google-ads-api ×1