我在使用 Facebook 广告时遇到错误:-
javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚。
我在 OnCreate 方法上的代码:-
AudienceNetworkAds.initialize(this);
AudienceNetworkInitializeHelper.initialize(DetailActivity.this);
adView = new AdView(DetailActivity.this, "602513XXXX33594_XXXXXXXXXXXXXX", AdSize.BANNER_HEIGHT_50);
LinearLayout adContainer = findViewById(R.id.banner_container);
adContainer.addView(adView);
adView.loadAd();
AdListener adListener = new AdListener() {
@Override
public void onError(Ad ad, AdError adError) {
Toast.makeText(DetailActivity.this, "Error ad:" + adError.getErrorMessage(), Toast.LENGTH_LONG).show();
Log.d("ErrorAd: ",adError.getErrorMessage());
}
@Override
public void onAdLoaded(Ad ad) {
}
@Override
public void onAdClicked(Ad ad) {
}
@Override
public void onLoggingImpression(Ad ad) {
}
};
// Request an ad
adView.loadAd(adView.buildLoadAdConfig().withAdListener(adListener).build());
.
.
.
.
@Override
protected void onDestroy() {
if (adView != null) {
adView.destroy();
}
super.onDestroy();
}
SSL证书错误以前不存在,但是当我使用我自己的VPS服务器的https webservices时,我得到了这个。需要帮忙。