2

我已经集成了华为 AdsKit(横幅广告)并注册了AdListener. onAdFailederrorCode= 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
  • 华为广告演示应用程序(git@github.com:HMS-Core/hms-ads-demo-java.git)工作正常
4

1 回答 1

2

这似乎是一个 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);) - 它没有帮助。

不要设置关键字来解决它。

于 2021-01-12T19:22:48.803 回答