0

I'm using crosswalk browser to make android hybrid application. I added firebase messaging file, but it doesn't work in some of android device. Here is my error text.

Error:Execution failed for task ':app:transformClassesWithDexForArmv7Debug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/common/api/zza;

And here is my application build file

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "com.example"
        minSdkVersion 18
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    /*crossWalk*/
    productFlavors {
        armv7 {
            ndk {
                abiFilters "armeabi-v7a", ""
            }
        }
        x86 {
            ndk {
                abiFilters "x86", ""
            }
        }
    }
}

repositories {
    /*crossWalk*/
    maven {
        url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.0.1'
    compile 'org.xwalk:xwalk_core_library:10.39.235.15'
    compile 'junit:junit:4.12'
    compile ('com.google.firebase:firebase-messaging:9.6.1'){
        exclude group: 'com.google.android.gms'
    }
    compile 'com.squareup.okhttp3:okhttp:3.2.0'
}

And here is my project build file

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
       classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

How can I build this application again? Please help me

Surya Prakash Kushawah
  • 3,185
  • 1
  • 22
  • 42

1 Answers1

0

because google play service package is big it should use multidex, therefore use multidex dependencies like this

android {
compileSdkVersion 25
buildToolsVersion "25.0.1"

     defaultConfig {
         minSdkVersion 14 //lower than 14 doesn't support multidex
         targetSdkVersion 25

         // Enabling multidex support.
         multiDexEnabled true
     }
}

dependencies {
    compile 'com.android.support:multidex:1.0.1'
}

and in your launcher activity or an activity that extended from Application initialize it

public class YouApplication extends Application {

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

}
masoud vali
  • 1,528
  • 2
  • 18
  • 29
  • 2
    Looks like you just copied what I already commented with... Anyways. It is not because the play services are too big. That is a different error. The libraries have overlapping dependencies – OneCricketeer Dec 07 '16 at 05:25