I have an SDK access code. Everything is normal in as, but it cannot be used correctly in b4x. I use logcat to check the log and find an error in init. Prompt: com qq. e.comm.managers. plugin. e: Fail to init GDTADPLugin,PluginClassLoader == null; while loading factory impl for:interface
There is engineering code in the attachment. Please help me. Thank you very much!
Demo download
http://www.xxtapp.top/Demo.zip
There is engineering code in the attachment. Please help me. Thank you very much!
Demo download
http://www.xxtapp.top/Demo.zip
Java:
public void onClick(View v) {
if(v.getId()==R.id.button)
{
Toast.makeText(this, "Init", Toast.LENGTH_SHORT).show();
GDTAdSdk.init(getApplicationContext(),"1200014716");
}
if(v.getId()==R.id.button2)
{
UnifiedInterstitialADListener iadListener = new UnifiedInterstitialADListener () {
@Override
public void onADReceive() {
iad.show();
}
@Override
public void onVideoCached() { }
@Override
public void onNoAD(AdError error) {
Toast.makeText(getApplicationContext(), error.getErrorCode()+error.getErrorMsg(), Toast.LENGTH_SHORT).show();
}
@Override
public void onADOpened() { }
@Override
public void onADExposure() { }
@Override
public void onADClicked() { }
@Override
public void onADLeftApplication() { }
@Override
public void onADClosed() { }
@Override
public void onRenderSuccess() { }
@Override
public void onRenderFail() { }
};
iad = new UnifiedInterstitialAD(this, "5062326323029403", iadListener);
iad.loadAD();
}
}
B4X:
Sub Button1_Click
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("Init",Null)
End Sub
Sub Button2_Click
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("Show",Null)
End Sub
#if java
//SDK
import com.qq.e.comm.util.AdError;
import com.qq.e.comm.managers.GDTAdSdk;
import com.qq.e.ads.interstitial2.UnifiedInterstitialAD;
import com.qq.e.ads.interstitial2.UnifiedInterstitialADListener;
private UnifiedInterstitialAD iad;
public void Init() {
processBA.Log("init");
GDTAdSdk.init(this, "1200014716");
}
public void Show() {
UnifiedInterstitialADListener iadListener = new UnifiedInterstitialADListener () {
@Override
public void onADReceive() {
iad.show();
}
@Override
public void onVideoCached() {}
@Override
public void onNoAD(AdError error) {
processBA.Log(error.getErrorCode()+error.getErrorMsg());
}
@Override
public void onADOpened() {}
@Override
public void onADExposure() {}
@Override
public void onADClicked() {}
@Override
public void onADLeftApplication() {}
@Override
public void onADClosed() {}
@Override
public void onRenderSuccess() {}
@Override
public void onRenderFail() {}
};
iad = new UnifiedInterstitialAD(this, "5062326323029403", iadListener);
iad.loadAD();
}
#End If