Vungle(SDKBox) problem

Hi! I’m a new one using cocos2d-x.

I succeessfully made Vungle Reward video on iOS as my developing env is based on Xcode.

Today, I tried to integrate Vungle into Android platform on Eclipse, but failed.

version info: Cocos2d-x 3.2 & sdkbox-vungle v1.5.3.3 (including vungle-publisher-adaptive-id-3.3.3.1.jar)

eclipse log messages:

D/SDKBOX(17033): Applied config // sdkbox_config.json contents logged

I/SDKBox(17033): class name : ----com/sdkbox/plugin/PluginVungle----
I/dalvikvm(17033): Failed resolving Lcom/vungle/publisher/location/GoogleLocationClientDetailedLocationProvider; interface 2325 ‘Lcom/google/android/gms/common/GooglePlayServicesClient$ConnectionCallbacks;’

W/dalvikvm(17033): Link of class ‘Lcom/vungle/publisher/location/GoogleLocationClientDetailedLocationProvider;’ failed
E/dalvikvm(17033): Could not find class ‘com.vungle.publisher.location.GoogleLocationClientDetailedLocationProvider’, referenced from method com.vungle.publisher.inject.ConfigurablePublisherModule.a

W/dalvikvm(17033): VFY: unable to resolve new-instance 9196 (Lcom/vungle/publisher/location/GoogleLocationClientDetailedLocationProvider;) in Lcom/vungle/publisher/inject/ConfigurablePublisherModule;
I/dalvikvm(17033): Failed resolving Lcom/vungle/publisher/location/GoogleLocationClientDetailedLocationProvider; interface 2325 ‘Lcom/google/android/gms/common/GooglePlayServicesClient$ConnectionCallbacks;’

W/dalvikvm(17033): Link of class ‘Lcom/vungle/publisher/location/GoogleLocationClientDetailedLocationProvider;’ failed
D/dalvikvm(17033): DexOpt: unable to opt direct call 0xe5c6 at 0x03 in Lcom/vungle/publisher/inject/ConfigurablePublisherModule;.a

After hours of Internet searching, I figured GooglePlayServicesClient is replaced by GoogleApiClient.

Any help would be appreciated :slight_smile:

Did you any any extra jar files after adding Vungle plugin from SDKBOX !!
If you simply import sdkbox import vungle it would add all the necessary jar files.

You just need to change the ID’s inside sdkbox_config.json file.

Can we take a look at your project.properties files, it looks like, you might have the incorrect google play service or it’s missing

Yeap, I did add all the jar files required: PluginVungle.jar / sdkbox.jar / android-support-v4.jar / nineoldandroids-2.4.0.jar / javax.inject-1.jar / dagger-1.2.2.jar

At my first shot, I tried sdkbox import vungle command in terminal but failed anyway.

So I manually integrated vungle sdkbox :slight_smile:

And sdkbox_config.json file is well settled so I succeeded in watching test ad in my iOS app.

Not so much proceeding in Android app though :frowning:

I’m kind of Android novice, so there would be high chance that I missed something :smile:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-23

android.library.reference.1=libs/facebook

It looks like project.properties is automatically generated.

Am I missing google play service setting? :frowning:

Here’s my one more step til now.

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-23

android.library.reference.1=libs/google-play-services_lib

I added dependency of google play service lib folder into the existing project.

There was ‘dex loader unable to execute dex: method ID not in [0, 0xffff]: 65536’ problem after I added a new library, so removed some of obsolete and unnecessary libraries.

Anyway, compile done, executed my application, and then,

D/main(10522): cocos_android_app_init I/SDKBOX(10522): sdkbox::SdkboxCore::SdkboxCore():79= INF: Initializing sdkbox core. I/dalvikvm(10522): Failed resolving Lcom/vungle/publisher/location/GoogleLocationClientDetailedLocationProvider; interface 1958 'Lcom/google/android/gms/common/GooglePlayServicesClient$ConnectionCallbacks;' W/dalvikvm(10522): Link of class 'Lcom/vungle/publisher/location/GoogleLocationClientDetailedLocationProvider;' failed E/dalvikvm(10522): Could not find class 'com.vungle.publisher.location.GoogleLocationClientDetailedLocationProvider', referenced from method com.vungle.publisher.inject.ConfigurablePublisherModule.a W/dalvikvm(10522): VFY: unable to resolve new-instance 7950 (Lcom/vungle/publisher/location/GoogleLocationClientDetailedLocationProvider;) in Lcom/vungle/publisher/inject/ConfigurablePublisherModule; D/dalvikvm(10522): VFY: replacing opcode 0x22 at 0x0001 I/dalvikvm(10522): Failed resolving Lcom/vungle/publisher/location/GoogleLocationClientDetailedLocationProvider; interface 1958 'Lcom/google/android/gms/common/GooglePlayServicesClient$ConnectionCallbacks;' W/dalvikvm(10522): Link of class 'Lcom/vungle/publisher/location/GoogleLocationClientDetailedLocationProvider;' failed D/dalvikvm(10522): DexOpt: unable to opt direct call 0xce04 at 0x03 in Lcom/vungle/publisher/inject/ConfigurablePublisherModule;.a
Vungle really doesn’t work at all…
Vungle logs say…

W/VungleDevice(10522): error unregistering external storage state broadcast receiver - not registered
W/VungleNetwork(10522): error unregistering network broadcast receiver - not registered
W/VungleDumpDatabase(10522): error unregistering database broadcast receiver - not registered

So nothing has been changed much. SAD…

Have you followed every step as mentioned in the Manual Integration For Android correctly.
Also, as you are using cocos2d-x v3.2, have you changed your Application.mk as mentioned in the docs.

Modify Application.mk (Cocos2d-x v3.0 to v3.2 only)
Edit <project_root>/jni/Application.mk to make sure APP_STL is defined correctly. If Application.mk contains APP_STL := c++_static, it should be changed to:

APP_STL := gnustl_static

Also, could you tell us what errors did you get while you were using sdkbox import vungle !!

Best,
Pabitra

Yeap. Everything done :smile:

Edited AndroidManifest.xml

Edited Android.mk

didn’t Modify Application.mk though
Because the value was stated: APP_STL:=c++_shared
I tried both gnustl_static and gnustl_shared but failed for both.
The library setting in Xcode seems to be llvm based and didn’t work on gnustl libraries.

And modified Cocos2dxActivity.java.

All stated in http://docs.sdkbox.com/en/plugins/vungle/v3-cpp/ were done exception an optional setting(proguard).

Am I still missing something?!

BTW, when I used sdkbox import vungle command, sdkbox initialized its importing steps only to fail.

Here we go.

$ sdkbox import vungle
  _______ ______  _     _ ______   _____  _     _
  |______ |     \ |____/  |_____] |     |  \___/ 
  ______| |_____/ |    \_ |_____] |_____| _/   \_
 Copyright (c) 2015 SDKBOX Inc. v1.0.0.2
 Installation Successful :)
 failed to patch file Cocos2dxActivity.java
 failed to patch file AppDelegate.cpp
 Please reference the online documentation to finish the integration:
http://sdkbox-doc.github.io/en/plugins/vungle/v3-cpp/
 Some installation steps failed.
 Please refer to the online documentation, for instructions on how to complete the installation manually.
 Installation completed with errors :|

This is just means you have to manually edit Cocos2dxActivity.java file

These three error message looks like it’s missing some permissions

W/VungleDevice(10522): error unregistering external storage state broadcast receiver - not registered
W/VungleNetwork(10522): error unregistering network broadcast receiver - not registered
W/VungleDumpDatabase(10522): error unregistering database broadcast receiver - not registered

Can I take a look at your AndroidManifest.xml?

Sure. codes related to this issue included:

        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 

        <activity
          android:name="com.vungle.publisher.FullScreenAdActivity"
          android:configChanges="keyboardHidden|orientation"
          android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.android.vending.BILLING" />
    <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

I highly suspect Vungle includes deprecated Google Play Service interface in its API and that leads to initialization of Vungle.

SDKBOX initialization always succeeds like below.

I/SDKBOX(10522): sdkbox::SdkboxCore::SdkboxCore():79= INF: Initializing sdkbox core.
I/dalvikvm(10522):
 Failed resolving 
Lcom/vungle/publisher/location/GoogleLocationClientDetailedLocationProvider;
 interface 1958 
'Lcom/google/android/gms/common/GooglePlayServicesClient$ConnectionCallbacks;'

Hmm, I’ll ask vungle developer about this issue.

buildpath->Order and Export->select All,I got it by this.