When compiling a project with google-play-services and google-maps connected libraries, gradle issues

Consider using to minSdkversion 21 or multiDexEnabled true 

I tried to connect multiDex and add this line to the config, but still nothing happened. How to be?

    2 answers 2

    Check the connection.

    Multidex connects in two places: directive in build.gradle

     android { defaultConfig { .... multiDexEnabled true } } 

    and inheritance of your Application class from MultiDexApplication . If you have redefined Application, change the parent class in your application class to MultiDexApplication . If not, add the <application> parameter to the AndroidManifest.xml tag

     android:name="android.support.multidex.MultiDexApplication" 

      So wrong connect multiDex . In android versions below 21, the code is executed by dalvik . It has a peculiarity in that the number of methods in the dex file should not exceed just over 65,000 methods. With 21 api, the code is executed with the help of ART . There is no such feature.

      In order to connect multiDex you need: instruction

      • As a result, apk will be 2 classes.dex? - Flippy
      • For dalvik yes. The project will last longer true - pavel163
      • You can try minifyEnabled true. Proguard cuts out unused methods and multidex may not be needed - Maxgmer
      • Yes, that's good advice. The only thing is that it needs to be turned on at the initial stage of the project, otherwise you can sit down with error correction for a long time))) - pavel163
      • @ pavel163 Yes, no, with Proguard now everything is quite smooth, not like before. I myself was surprised. jollydroid.ru/notebook/2016-12-29-ProGuard-1 - tse