Vungle stops working after first Ad display

I just integrated Vungle with SDKBox on my application. It works perfectly on the first time the Ad is displayed. The second time I try to show another Ad, an error appears on the console and no ad is shown:

“Error encountered playing vungle ad: Error Domain=VungleSDK Code=3 “(null)””

This is my code:

sdkbox::PluginVungle::setListener(this);
sdkbox::PluginVungle::show("video");

And in the applicationDidFinishLaunching the following init:

   sdkbox::PluginVungle::init();

Any help?

Did you specify your Vungle credentials in sdkbox_config.json?

Are the ads available yet? Perhaps they are still loading?

Take a look here: http://sdkbox-doc.github.io/en/plugins/vungle/v3-cpp/#api-reference

There are a few commands to check…static bool isCacheAvailable ( ) ;

Also, there is a listener for this: void onVungleCacheAvailable ( );, so perhaps look at what is happening here. Maybe add a CCLOG here…

The ads are available.
And the first one plays fine.

The error only appears when I try to play another Ad.

Does it happens on iOS or Android or Both

It now works perfectly on iOS. I was behind a proxy and the ads where being blocked, so I could only see the first ad (on cache and maybe downloaded previously from the time I was not with the proxy).

The problem now is only on Android. The cache is available each time I try to play an Ad but as the Ad stars playing it stops and goes to the “download Now” screen. What did I miss?

Possibly missing a activity in your AndroidManifest.xml

It was the minSdkVersion. I had:
uses-sdk android:minSdkVersion=“15”

it only works with
uses-sdk android:minSdkVersion=“9”

This issue persists on version v1.5.1.4 vungle.

with minSdkVersion=“9” it works perfectly

with an higher version, the first ad plays until the end. the second video ad doesn’t play at all. and the display is redirected to the end of the ad.

this is the error on logcat:

E/Parcel  (  774): Class not found when unmarshalling: com.vungle.publisher.c
E/Parcel  (  774): java.lang.ClassNotFoundException: com.vungle.publisher.c
E/Parcel  (  774): Caused by: java.lang.NoClassDefFoundError: com/vungle/publisher/c
E/Parcel  (  774): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.vungle.publisher.c" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

I would like to use minSDK > 11. Any solutions?

Hello @pccsoares

I do not see the issue is there with the minSdkVersion
because it works fine in 15 as well.

could you tell me which version of SDKBOX and cocos you are using ?
also on which target platform you are testing this… !!

make sure your project.properties have these

android.library.reference.2=../../google-play-services_lib/
android.library.reference.3=../cocos2d/cocos/platform/android/java/libs/gps/

Change the path as per your directory order.

Best,
Pabitra

@pccsoares Do you have google play service for your project?

This bug same to me, I can’t play ads on iOS when I call sdkbox::PluginVungle::show(“video”);
Error:
Vungle :Error encountered playing vungle ad: �\302�\227\245�
[VUNGLESDK] request ad: sleep
Please help me!

Vungle ads sometimes take time to download, you can use isCacheAvailable() to check if the cached is downloaded before playing the ad.

thank you so much

isCacheAvailable() always return true, but show video reward not work, and I can’t play video

p/s: I got it, because device daily limit, but isCacheAvailable() return true, how can I check the video can play???

I also have a similar problem, but in my case the app crashes when I close the first ad that plays. When I hit the X button app crashes. Here is the logcat:

06-27 00:56:00.451: I/ViewRootImpl(15506): ViewRoot's Touch Event : Touch Down
06-27 00:56:00.551: I/ViewRootImpl(15506): ViewRoot's Touch Event : Touch UP
06-27 00:56:00.931: D/Cocos2dxActivity(15506): onResume()
06-27 00:56:01.291: D/Cocos2dxActivity(15506): onWindowFocusChanged() hasFocus=true
06-27 00:56:01.291: V/MediaPlayer[Native](15506): start
06-27 00:56:01.291: D/MediaPlayer[Native](15506): calling notify_player_state: 16
06-27 00:56:01.351: D/MediaPlayer[JAVA](15506): broadcasting MEDIA_CHANGE_PLAYER_STATE(no context) : 0x0
06-27 00:56:01.351: V/MediaPlayer[Native](15506): invoke 72
06-27 00:56:01.351: D/MediaPlayer[Native](15506): invoke lgeInvokeId=0x7e000002
06-27 00:56:01.351: D/MediaPlayer[Native](15506): MediaPlayer::invoke::getparam
06-27 00:56:01.351: D/MediaPlayer[Native](15506): MediaPlayer::getParameter mCurrentState = 0x00000010
06-27 00:56:01.351: D/MediaPlayer[JAVA](15506): broadcasting MEDIA_CHANGE_PLAYER_STATE(no context) : state = 16
06-27 00:56:01.351: V/MediaPlayer[Native](15506): getCurrentPosition
06-27 00:56:01.351: V/MediaPlayer[Native](15506): getDuration_l
06-27 00:56:01.371: D/BubblePopupHelper(15506): isShowingBubblePopup : false
06-27 00:56:01.371: D/BubblePopupHelper(15506): isShowingBubblePopup : false
06-27 00:56:01.401: D/AndroidRuntime(15506): Shutting down VM
06-27 00:56:01.401: W/dalvikvm(15506): threadid=1: thread exiting with uncaught exception (group=0x4172fe48)
06-27 00:56:01.401: E/AndroidRuntime(15506): FATAL EXCEPTION: main
06-27 00:56:01.401: E/AndroidRuntime(15506): Process: com.me.mygame, PID: 15506
06-27 00:56:01.401: E/AndroidRuntime(15506): java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
06-27 00:56:01.401: E/AndroidRuntime(15506): 	at com.google.android.gms.common.internal.zzd$zza.zzc(Unknown Source)
06-27 00:56:01.401: E/AndroidRuntime(15506): 	at com.google.android.gms.common.internal.zzd$zza.zzw(Unknown Source)
06-27 00:56:01.401: E/AndroidRuntime(15506): 	at com.google.android.gms.common.internal.zzd$zze.zztr(Unknown Source)
06-27 00:56:01.401: E/AndroidRuntime(15506): 	at com.google.android.gms.common.internal.zzd$zzd.handleMessage(Unknown Source)
06-27 00:56:01.401: E/AndroidRuntime(15506): 	at android.os.Handler.dispatchMessage(Handler.java:102)
06-27 00:56:01.401: E/AndroidRuntime(15506): 	at android.os.Looper.loop(Looper.java:136)
06-27 00:56:01.401: E/AndroidRuntime(15506): 	at android.app.ActivityThread.main(ActivityThread.java:5103)
06-27 00:56:01.401: E/AndroidRuntime(15506): 	at java.lang.reflect.Method.invokeNative(Native Method)
06-27 00:56:01.401: E/AndroidRuntime(15506): 	at java.lang.reflect.Method.invoke(Method.java:515)
06-27 00:56:01.401: E/AndroidRuntime(15506): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
06-27 00:56:01.401: E/AndroidRuntime(15506): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
06-27 00:56:01.401: E/AndroidRuntime(15506): 	at dalvik.system.NativeStart.main(Native Method)
06-27 00:56:04.324: I/Process(15506): Sending signal. PID: 15506 SIG: 9

I have no idea how this can be fixed.

Hi @Boby:

Are you adding Google Play Services too?

Thanks,

Yes, I’ve managed to somehow solve this by creating a new project from sources, my old one was using precompiled libraries. Now it works, but every time I close a vungle ad it tries to reconnect to google play services, and that’s annoying. I’m now trying a release build to see if my app manages to connect to Google Play Services successfully(in debug mode it doesn’t, sdkboxplay also doesn’t show leaderboards) and maybe it won’t keep trying to reconnect each time I view an ad. Any idea why vungle(and also tweeter) does this?

I’m sorry, but I fixed my bugs adding/updating GPS in the past.

Maybe @nite helps you with this bug.

Well apparently it works in release mode. Probably because the debug key used to sign the debug version.

I’m glad to hear that. Good luck!