Search code examples
javaandroidgradlegoogle-play-servicesvungle-ads

Vungle initialization crashes when BaseGameUtils compiled


I'm encountering a wierd problem. When I'm compiling the BaseGameUtils library through Gradle my app crashing on initialization of Vungle.
I really dont know why is that happening and I even dont know what should I show you to help me fix that.
Here's the error message:

java.lang.NoClassDefFoundError: com.vungle.publisher.sj
 at com.vungle.publisher.ta.<init>(vungle:1922)
 at com.vungle.publisher.ta.<init>(vungle:720)
 at com.vungle.publisher.VunglePubBase.init(vungle:97)
 at com.vungle.publisher.VunglePub.init(vungle:33)
 at com.swipe.game.AndroidLauncher.onCreate(AndroidLauncher.java:101)
 at android.app.Activity.performCreate(Activity.java:5122)
 at   android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1150)
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2315)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2403)
 at android.app.ActivityThread.access$600(ActivityThread.java:165)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
 at android.os.Handler.dispatchMessage(Handler.java:107)
 at android.os.Looper.loop(Looper.java:194)
 at android.app.ActivityThread.main(ActivityThread.java:5391)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:525)
 t com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
 at dalvik.system.NativeStart.main(Native Method)

But that's not saying anything on my opinion.
Also providing an AndroidManifest(of baseutils) and Gradle file(of baseutils).
Manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
      package="com.google.example.games.basegameutils"
      android:versionCode="1"
      android:versionName="1.0">

<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="23"/>

<application>
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</application>

Gradle:

    apply plugin: 'com.android.library'

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0'
    }
}

dependencies {
    compile "com.android.support:appcompat-v7:24.2.0"
    compile "com.android.support:support-v4:24.2.0"
    compile "com.google.android.gms:play-services-games:9.4.0"
    compile "com.google.android.gms:play-services-plus:9.4.0"
}

android {
    // Set defaults so that BaseGameUtils can be used outside of BasicSamples
    if (!project.hasProperty('android_compile_version')) {
        ext.android_compile_version = 23
    }
    if (!project.hasProperty('android_version')) {
        ext.android_version = '23'
    }

    compileSdkVersion android_compile_version
    buildToolsVersion android_version
}

Hope somebody can help me figure this out. Feel free to ask for other code examples that u need. Thanks.


Solution

  • Idk why, but once I changed the gms version to 8.4.0 - it started to work w/o any warning or exceptions. I dont really planning on using the features from 9.4.0 so I'll keep 8.4.0 version for my game.