android - 华为AdsKit AdListener.onAdFailed errorCode 2是什么意思?

标签 android huawei-mobile-services huawei-ads

我已经集成了华为AdsKit(横幅广告)并注册了AdListeneronAdFailed调用时使用 errorCode = 2。原因可能是什么?

日志中有一些[奇怪]的东西(JSON 错误):

2021-01-12 23:26:11.107 30332-30332 I/HiAdSDK.ae:  setBannerAdSize width: 468  height: 60
2021-01-12 23:26:11.115 30332-30417 W/HiAdSDK.HMSConnectProcessor:  check hms sdk available error
2021-01-12 23:26:11.118 30332-30417 I/HiAdSDK.HiAd:  ppskit api is not included
2021-01-12 23:26:14.025 30332-30332 I/HiAdSDK.PPSBannerViewViewMonitor:  onViewAttachedToWindow
2021-01-12 23:26:14.026 30332-30332 I/HiAdSDK.PPSBannerViewViewMonitor:  registerObservers
2021-01-12 23:26:14.028 30332-30332 I/HiAdSDK.PPSBannerViewViewMonitor:  onViewVisibilityChanged
2021-01-12 23:26:14.035 30332-30332 I/HiAdSDK.PPSNativeViewViewMonitor:  onViewAttachedToWindow
2021-01-12 23:26:14.036 30332-30332 I/HiAdSDK.PPSNativeViewViewMonitor:  registerObservers
2021-01-12 23:26:14.037 30332-30332 I/HiAdSDK.PPSNativeViewViewMonitor:  onViewVisibilityChanged
2021-01-12 23:26:14.041 30332-30332 I/HiAdSDK.PPSNativeViewViewMonitor:  onViewAttachedToWindow
2021-01-12 23:26:14.042 30332-30332 I/HiAdSDK.PPSNativeViewViewMonitor:  registerObservers
2021-01-12 23:26:14.043 30332-30332 I/HiAdSDK.PPSNativeViewViewMonitor:  onViewVisibilityChanged
2021-01-12 23:26:16.545 30332-30332 I/HiAdSDK.PPSBannerViewViewMonitor:  onViewVisibilityChanged
2021-01-12 23:26:16.546 30332-30332 I/HiAdSDK.PPSNativeViewViewMonitor:  onViewVisibilityChanged
2021-01-12 23:26:16.547 30332-30332 I/HiAdSDK.PPSNativeViewViewMonitor:  onViewVisibilityChanged
2021-01-12 23:26:16.553 30332-30332 I/HiAdSDK.ae:  load banner 
2021-01-12 23:26:16.567 30332-30332 I/HiAdSDK.h:  loadAds
2021-01-12 23:26:16.615 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:26:16.615 30332-30432 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:26:16.616 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag sendAsyncLocationByNative failed because switch is off
2021-01-12 23:26:16.654 30332-30432 W/HiAdSDK.jd:  Root obj class (class java.lang.Object) is invalid
2021-01-12 23:26:16.655 30332-30432 W/HiAdSDK.jd:  toJson jsex
2021-01-12 23:26:16.663 30332-30432 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqNativeAd
2021-01-12 23:26:16.667 30332-30432 I/HiAdSDK.Decouple.PPSApiServiceManager:  bindService 1610475976666
2021-01-12 23:26:16.668 30332-30432 I/HiAdSDK.HiAdTools:  current connected service pkg: null
2021-01-12 23:26:16.675 30332-30432 I/HiAdSDK.HiAdTools:  isSupportHmsAdsService hms ver: 50005300
2021-01-12 23:26:16.679 30332-30432 I/HiAdSDK.Decouple.PPSApiServiceManager:  bind service pkg: com.huawei.hwid
2021-01-12 23:26:16.689 30332-30432 I/HiAdSDK.Decouple.PPSApiServiceManager:  bind service result: true
2021-01-12 23:26:16.694 30332-30435 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqConfig
2021-01-12 23:26:16.696 30332-30435 I/HiAdSDK.Decouple.PPSApiServiceManager:  bindService 1610475976695
2021-01-12 23:26:16.698 30332-30435 I/HiAdSDK.HiAdTools:  current connected service pkg: null
2021-01-12 23:26:16.705 30332-30435 I/HiAdSDK.HiAdTools:  isSupportHmsAdsService hms ver: 50005300
2021-01-12 23:26:16.708 30332-30435 I/HiAdSDK.Decouple.PPSApiServiceManager:  bind service pkg: com.huawei.hwid
2021-01-12 23:26:16.715 30332-30435 I/HiAdSDK.Decouple.PPSApiServiceManager:  bind service result: true
2021-01-12 23:26:16.918 30332-30332 I/HiAdSDK.PPSBannerViewViewMonitor:  onViewShown
2021-01-12 23:26:17.134 30332-30332 I/HiAdSDK.Decouple.PPSApiServiceManager:  PPS remote service connected 1610475977134
2021-01-12 23:26:17.137 30332-30332 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: AidlConnectMonitorMethod
2021-01-12 23:26:17.156 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqNativeAd code: -1 msg: JSONException:Input json string cannot be empty!
2021-01-12 23:26:17.160 30332-30430 I/HiAdSDK.h:  onAdFailed, errorCode:-1
2021-01-12 23:26:17.445 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqConfig code: 200 msg: null
2021-01-12 23:26:37.668 30332-30433 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: apistatistics
2021-01-12 23:26:37.700 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call apistatistics code: 200 msg: null
2021-01-12 23:26:46.930 30332-30332 I/HiAdSDK.h:  loadAds
2021-01-12 23:26:46.936 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:26:46.937 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag sendAsyncLocationByNative failed because switch is off
2021-01-12 23:26:46.952 30332-30417 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:26:46.990 30332-30417 W/HiAdSDK.jd:  Root obj class (class java.lang.Object) is invalid
2021-01-12 23:26:46.992 30332-30417 W/HiAdSDK.jd:  toJson jsex
2021-01-12 23:26:46.994 30332-30417 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqNativeAd
2021-01-12 23:26:47.001 30332-30432 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqConfig
2021-01-12 23:26:47.007 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqNativeAd code: -1 msg: JSONException:Input json string cannot be empty!
2021-01-12 23:26:47.009 30332-30430 I/HiAdSDK.h:  onAdFailed, errorCode:-1
2021-01-12 23:26:47.021 30332-30433 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: apistatistics
2021-01-12 23:26:47.054 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call apistatistics code: 200 msg: null
2021-01-12 23:26:47.261 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqConfig code: 200 msg: null
2021-01-12 23:27:16.954 30332-30332 I/HiAdSDK.h:  loadAds
2021-01-12 23:27:16.961 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:27:16.961 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag sendAsyncLocationByNative failed because switch is off
2021-01-12 23:27:16.978 30332-30448 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:27:17.009 30332-30448 W/HiAdSDK.jd:  Root obj class (class java.lang.Object) is invalid
2021-01-12 23:27:17.010 30332-30448 W/HiAdSDK.jd:  toJson jsex
2021-01-12 23:27:17.012 30332-30448 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqNativeAd
2021-01-12 23:27:17.018 30332-30448 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqConfig
2021-01-12 23:27:17.023 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqNativeAd code: -1 msg: JSONException:Input json string cannot be empty!
2021-01-12 23:27:17.025 30332-30430 I/HiAdSDK.h:  onAdFailed, errorCode:-1
2021-01-12 23:27:17.035 30332-30434 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: apistatistics
2021-01-12 23:27:17.070 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call apistatistics code: 200 msg: null
2021-01-12 23:27:17.277 30332-30356 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqConfig code: 200 msg: null
2021-01-12 23:27:46.980 30332-30332 I/HiAdSDK.h:  loadAds
2021-01-12 23:27:46.989 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:27:46.991 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag sendAsyncLocationByNative failed because switch is off
2021-01-12 23:27:47.007 30332-30432 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:27:47.048 30332-30432 W/HiAdSDK.jd:  Root obj class (class java.lang.Object) is invalid
2021-01-12 23:27:47.050 30332-30432 W/HiAdSDK.jd:  toJson jsex
2021-01-12 23:27:47.053 30332-30432 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqNativeAd
2021-01-12 23:27:47.061 30332-30455 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqConfig
2021-01-12 23:27:47.067 30332-30356 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqNativeAd code: -1 msg: JSONException:Input json string cannot be empty!
2021-01-12 23:27:47.069 30332-30430 I/HiAdSDK.h:  onAdFailed, errorCode:-1
2021-01-12 23:27:47.075 30332-30433 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: apistatistics
2021-01-12 23:27:47.112 30332-30356 I/HiAdSDK.Decouple.PPSApiServiceManager:  call apistatistics code: 200 msg: null
2021-01-12 23:27:47.333 30332-30349 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqConfig code: 200 msg: null
2021-01-12 23:28:17.012 30332-30332 I/HiAdSDK.h:  loadAds
2021-01-12 23:28:17.024 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:28:17.025 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag sendAsyncLocationByNative failed because switch is off
2021-01-12 23:28:17.044 30332-30458 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:28:17.065 30332-30458 W/HiAdSDK.jd:  Root obj class (class java.lang.Object) is invalid
2021-01-12 23:28:17.066 30332-30458 W/HiAdSDK.jd:  toJson jsex
2021-01-12 23:28:17.068 30332-30458 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqNativeAd
2021-01-12 23:28:17.073 30332-30458 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqConfig
2021-01-12 23:28:17.080 30332-30349 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqNativeAd code: -1 msg: JSONException:Input json string cannot be empty!
2021-01-12 23:28:17.083 30332-30430 I/HiAdSDK.h:  onAdFailed, errorCode:-1
2021-01-12 23:28:17.090 30332-30434 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: apistatistics
2021-01-12 23:28:17.127 30332-30349 I/HiAdSDK.Decouple.PPSApiServiceManager:  call apistatistics code: 200 msg: null
2021-01-12 23:28:17.328 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqConfig code: 200 msg: null
2021-01-12 23:28:47.046 30332-30332 I/HiAdSDK.h:  loadAds
2021-01-12 23:28:47.057 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:28:47.058 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag sendAsyncLocationByNative failed because switch is off
2021-01-12 23:28:47.079 30332-30463 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:28:47.109 30332-30463 W/HiAdSDK.jd:  Root obj class (class java.lang.Object) is invalid
2021-01-12 23:28:47.110 30332-30463 W/HiAdSDK.jd:  toJson jsex
2021-01-12 23:28:47.112 30332-30463 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqNativeAd
2021-01-12 23:28:47.127 30332-30465 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqConfig
2021-01-12 23:28:47.128 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqNativeAd code: -1 msg: JSONException:Input json string cannot be empty!
2021-01-12 23:28:47.131 30332-30430 I/HiAdSDK.h:  onAdFailed, errorCode:-1
2021-01-12 23:28:47.139 30332-30433 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: apistatistics
2021-01-12 23:28:47.180 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call apistatistics code: 200 msg: null
2021-01-12 23:28:47.363 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqConfig code: 200 msg: null
2021-01-12 23:29:17.086 30332-30332 I/HiAdSDK.h:  loadAds
2021-01-12 23:29:17.098 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:29:17.100 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag sendAsyncLocationByNative failed because switch is off
2021-01-12 23:29:17.115 30332-30469 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:29:17.143 30332-30469 W/HiAdSDK.jd:  Root obj class (class java.lang.Object) is invalid
2021-01-12 23:29:17.144 30332-30469 W/HiAdSDK.jd:  toJson jsex
2021-01-12 23:29:17.146 30332-30469 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqNativeAd
2021-01-12 23:29:17.152 30332-30469 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqConfig
2021-01-12 23:29:17.157 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqNativeAd code: -1 msg: JSONException:Input json string cannot be empty!
2021-01-12 23:29:17.159 30332-30430 I/HiAdSDK.h:  onAdFailed, errorCode:-1
2021-01-12 23:29:17.166 30332-30434 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: apistatistics
2021-01-12 23:29:17.196 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call apistatistics code: 200 msg: null
2021-01-12 23:29:17.421 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqConfig code: 200 msg: null
2021-01-12 23:29:47.116 30332-30332 I/HiAdSDK.h:  loadAds
2021-01-12 23:29:47.122 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:29:47.122 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag sendAsyncLocationByNative failed because switch is off
2021-01-12 23:29:47.138 30332-30473 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:29:47.167 30332-30473 W/HiAdSDK.jd:  Root obj class (class java.lang.Object) is invalid
2021-01-12 23:29:47.168 30332-30473 W/HiAdSDK.jd:  toJson jsex
2021-01-12 23:29:47.169 30332-30473 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqNativeAd
2021-01-12 23:29:47.176 30332-30475 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqConfig
2021-01-12 23:29:47.180 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqNativeAd code: -1 msg: JSONException:Input json string cannot be empty!
2021-01-12 23:29:47.181 30332-30430 I/HiAdSDK.h:  onAdFailed, errorCode:-1
2021-01-12 23:29:47.187 30332-30433 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: apistatistics
2021-01-12 23:29:47.226 30332-30372 I/HiAdSDK.Decouple.PPSApiServiceManager:  call apistatistics code: 200 msg: null
2021-01-12 23:29:47.461 30332-30356 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqConfig code: 200 msg: null
2021-01-12 23:30:17.140 30332-30332 I/HiAdSDK.h:  loadAds
2021-01-12 23:30:17.146 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:30:17.147 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag sendAsyncLocationByNative failed because switch is off
2021-01-12 23:30:17.162 30332-30469 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:30:17.184 30332-30469 W/HiAdSDK.jd:  Root obj class (class java.lang.Object) is invalid
2021-01-12 23:30:17.185 30332-30469 W/HiAdSDK.jd:  toJson jsex
2021-01-12 23:30:17.186 30332-30469 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqNativeAd
2021-01-12 23:30:17.193 30332-30473 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqConfig
2021-01-12 23:30:17.197 30332-30356 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqNativeAd code: -1 msg: JSONException:Input json string cannot be empty!
2021-01-12 23:30:17.199 30332-30430 I/HiAdSDK.h:  onAdFailed, errorCode:-1
2021-01-12 23:30:17.206 30332-30434 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: apistatistics
2021-01-12 23:30:17.246 30332-30356 I/HiAdSDK.Decouple.PPSApiServiceManager:  call apistatistics code: 200 msg: null
2021-01-12 23:30:17.440 30332-30356 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqConfig code: 200 msg: null
2021-01-12 23:30:47.164 30332-30332 I/HiAdSDK.h:  loadAds
2021-01-12 23:30:47.177 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:30:47.178 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag sendAsyncLocationByNative failed because switch is off
2021-01-12 23:30:47.195 30332-30486 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:30:47.216 30332-30486 W/HiAdSDK.jd:  Root obj class (class java.lang.Object) is invalid
2021-01-12 23:30:47.217 30332-30486 W/HiAdSDK.jd:  toJson jsex
2021-01-12 23:30:47.219 30332-30486 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqNativeAd
2021-01-12 23:30:47.223 30332-30486 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqConfig
2021-01-12 23:30:47.229 30332-30356 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqNativeAd code: -1 msg: JSONException:Input json string cannot be empty!
2021-01-12 23:30:47.231 30332-30430 I/HiAdSDK.h:  onAdFailed, errorCode:-1
2021-01-12 23:30:47.236 30332-30433 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: apistatistics
2021-01-12 23:30:47.287 30332-30356 I/HiAdSDK.Decouple.PPSApiServiceManager:  call apistatistics code: 200 msg: null
2021-01-12 23:30:47.454 30332-30349 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqConfig code: 200 msg: null
2021-01-12 23:31:17.197 30332-30332 I/HiAdSDK.h:  loadAds
2021-01-12 23:31:17.206 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:31:17.208 30332-30430 I/HiAdSDK.LocationUtils:  loc_tag sendAsyncLocationByNative failed because switch is off
2021-01-12 23:31:17.220 30332-30490 I/HiAdSDK.LocationUtils:  loc_tag isGpsSwitchOpen locationMode is 0
2021-01-12 23:31:17.242 30332-30490 W/HiAdSDK.jd:  Root obj class (class java.lang.Object) is invalid
2021-01-12 23:31:17.242 30332-30490 W/HiAdSDK.jd:  toJson jsex
2021-01-12 23:31:17.244 30332-30490 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqNativeAd
2021-01-12 23:31:17.252 30332-30492 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: reqConfig
2021-01-12 23:31:17.254 30332-30349 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqNativeAd code: -1 msg: JSONException:Input json string cannot be empty!
2021-01-12 23:31:17.256 30332-30430 I/HiAdSDK.h:  onAdFailed, errorCode:-1
2021-01-12 23:31:17.263 30332-30434 I/HiAdSDK.Decouple.PPSApiServiceManager:  call remote method: apistatistics
2021-01-12 23:31:17.300 30332-30349 I/HiAdSDK.Decouple.PPSApiServiceManager:  call apistatistics code: 200 msg: null
2021-01-12 23:31:17.482 30332-30349 I/HiAdSDK.Decouple.PPSApiServiceManager:  call reqConfig code: 200 msg: null

一些细节[可以产生影响]:

  • 用户未登录华为帐号(华为IAP已根据错误代码确认)。我希望广告不需要这样做。
  • 应用签名已通过 AdsKit 验证并且正常
  • 应用 ID 在 AndroidManifest.xml 中声明(似乎是正确的):
    <meta-data
            android:name="com.huawei.hms.client.appid"
            android:value="@string/APP_ID" />
  • 在使用 HMS Core 服务 5 的华为设备上进行测试
  • 华为广告演示应用 ( [email protected] :HMS-Core/hms-ads-demo-java.git) 运行正常

最佳答案

这似乎是一个 SDK 错误:如果使用 AdParam.Bulder 关键字,则还需要一些其他字段。

我将我的代码与示例进行了比较,发现了差异,我已经传递了广告请求关键字:

private AdParam requestAd(boolean addKeywords) {
        AdParam.Builder builder = new AdParam.Builder();
        // --- cut start ---
        if (addKeywords) {
            String[] keywords = context.getResources().getStringArray(R.array.ad_keywords);
            for (String eachKeyword : keywords) {
                builder.addKeyword(eachKeyword);
            }
        }
        // --- cut stop ---
        return builder.build();
    }

如果我指定性别 (builder.setGender(1);) - 它没有帮助。

不要设置关键字来解决这个问题。

关于android - 华为AdsKit AdListener.onAdFailed errorCode 2是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65689978/

相关文章:

java - 如何与 friend 分享推荐代码和 Play 商店应用程序

android - TextView 失败

android - 原生广告 MediaView 与华为广告实现中的约束不匹配

android - 以编程方式将边距添加到 RelativeLayout

android - 使用 React Native 更改键盘后面的背景颜色?

android - 以编程方式获取设备的 EMUI 版本

java - 我有华为站点工具包错误代码 :10017

Android Studio 3.0 不想显示我连接的华为 P10

android - 在 GMS 设备上实现了华为全广告 SDK 广告但广告没有出现 为什么?

android-studio - 不要在预览窗口创建线程 - 华为广告实现