Can I enable multidex in Android debug build only?

后端 未结 4 1355
南方客
南方客 2021-01-07 23:22

Dears, I read in many blog posts that multidex apps startup is slower than normal apps. My app uses a lot of libraries that exceed 64k methods so I use multidex. But w

4条回答
  •  遥遥无期
    2021-01-07 23:53

    suggested methods are not needed anymore as android studio became "smart enough". In fact, it will now give you a warning when you use minSdkVersion 21 (the old way) to speed up build time with dex:

    You no longer need a dev mode to enable multi-dexing during development, and this can break API version checks less...

    In the past, our documentation recommended creating a dev product flavor with has a minSdkVersion of 21, in order to enable multidexing to speed up builds significantly during development. That workaround is no longer necessary, and it has some serious downsides, such as breaking API access checking (since the true minSdkVersion is no longer known.) In recent versions of the IDE and the Gradle plugin, the IDE automatically passes the API level of the connected device used for deployment, and if that device is at least API 21, then multidexing is automatically turned on, meaning that you get the same speed benefits as the dev product flavor but without the downsides.

提交回复
热议问题