Search code examples
javaandroidgoogle-apiandroid-multidexkinvey

Kinvey with admob on android


Kinvey runs fine by itself but when I include

compile 'com.google.android.gms:play-services-ads:8.4.0' compile 'com.google.android.gms:play-services-appindexing:8.4.0'

in the gradle dependencies

I get the following error

Error:Execution failed for task ':android:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' finished with non-zero exit value 2

When I ad the kinvey jars to the gradle

Now I have tried researching this problem and tried multidexing and increasing the max heapsize which resulted in the following error

java.lang.NoClassDefFoundError: com.kinvey.java.core.KinveyClientRequestInitializer at com.kinvey.android.Client$Builder.(Client.java:574)

Oddly enough the issue only comes up when I include the ads api(WHICH MUST BE INCLUDED ALONG WITH KINVEY)

I am not sure how to resolve this problem or if this problem is related to the size of the dex file or if it is a redundant package I would appreciate help in this matter and thank you in advance for your response.


Solution

  • I figured it out I added

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(base);
    }
    

    to my launcher class