-1

please help, I can't build my project if I add firebase remote config to it.

I've three product flavors, and I added these dependdencies to be able to support back to api level9

indexLegacyCompile 'com.google.android.gms:play-services-analytics:9.6.1'
indexLegacyCompile 'com.google.android.gms:play-services-location:9.6.1'
indexLegacyCompile 'com.google.android.gms:play-services-gcm:9.6.1'

if I remove these lines I can build the project.

For my normal flavor I added play services and remote config like this:

indexCompile 'com.google.android.gms:play-services-analytics:10.2.6'
indexCompile 'com.google.android.gms:play-services-location:10.2.6'
indexCompile 'com.google.android.gms:play-services-gcm:10.2.6'
indexCompile 'com.google.firebase:firebase-config:10.2.6'

How can I solve it?

user3057944
  • 701
  • 1
  • 8
  • 19
  • What error do you see? Also, what are the configured build flavors? It looks like you are including the libraries twice in a "legacy" flavor. – BladeCoder May 31 '17 at 09:34
  • I added the full gradle file. If I don't add firebase to project I can multiple flavor types. here is the gradle file: https://pastebin.com/R2k0Lagp – user3057944 May 31 '17 at 09:58
  • What error do you see? Are you using new Firebase APIs that are not available in older Firebase versions? It's never a good idea to include 2 different versions of the same library with the same code base. – BladeCoder May 31 '17 at 10:21
  • Sorry for late answer, I get this exception if I dont comment out dependencies for the legacy build Error:Execution failed for task ':app:processIndexPreviewGoogleServices'. > Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.2.6. – user3057944 Jun 01 '17 at 08:01
  • That's the reason: you are mixing up two different versions of Google Play Services in the same app. All Google Play components must use the same version in each flavor. – BladeCoder Jun 01 '17 at 10:13
  • Android docs says I have to build multiple apk to be able to support back to api lvl 9 and be able to comple the last play-service from api lvl 14. – user3057944 Jun 01 '17 at 12:13
  • It seems to me that the version of the google-services plugin you are using requires newer versions of the dependencies. Use an older version for older dependencies or configure your project manually without the plugin. – BladeCoder Jun 01 '17 at 17:09
  • Also it may be a good time to drop support for API 9 since support libraries 26.0.0 and up will only support API 14+ as well – BladeCoder Jun 01 '17 at 17:11

1 Answers1

0

Probally the problem that is over 64k methods https://developer.android.com/studio/build/multidex.html

add this code on your gradle , try it:

android {
    defaultConfig {
        ...
        minSdkVersion 15 
        targetSdkVersion 25
        //add this line
        multiDexEnabled true
    }
    ...
}

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

Hope it works for you.

Morton
  • 5,380
  • 18
  • 63
  • 118
  • Hi, thanks, but it doesn't help. If I don't commit dependencies for legacy build, I get this exception: Error:Execution failed for task ':app:processIndexPreviewGoogleServices'. > Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.2.6. – user3057944 Jun 01 '17 at 08:04