【问题标题】:MultiDex error after updating GCM gradle更新 GCM gradle 后的 MultiDex 错误
【发布时间】:2016-06-10 05:38:58
【问题描述】:

我正在使用

compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-appinvite:8.4.0'

在我的应用程序 build.gradle 和我的项目 build.gradle 中

classpath 'com.google.gms:google-services:2.0.0-beta2'

从过去 10 天开始,我在 InstanceId 时因为 GCM 而崩溃。 所以我发现我们需要将 GCM 更新到最新的 gradle,所以我也这样做了

classpath 'com.google.gms:google-services:3.0.0'

compile 'com.google.android.gms:play-services-gcm:9.0.2'
compile 'com.google.android.gms:play-services-appinvite:9.0.2'

但是由于这个原因,现在出现了 Multidex 错误。所以我也尝试通过以下几个步骤来解决这个问题,比如使用 MultiDexApplication 扩展 Application 类等等。仍然遇到同样的问题。

我的 gradle 依赖项

 compile project(':aws-android-sdk-core-2.2.9')
compile project(':aws-android-sdk-s3-2.2.9')
compile project(':universal-image-loader-1.9.5')
compile project(':FlurryAnalytics-6.2.0')
compile project(':circularImageView')
compile project(':swipeMenuListView')
compile 'com.couchbase.lite:couchbase-lite-android:1.2.0'
compile 'com.instabug.library:instabugsupport:1.+'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-appinvite:8.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:multidex:1.0.1'

任何帮助将不胜感激!

【问题讨论】:

  • 尝试清理并重新构建项目?
  • 发布你的 gradle 代码
  • 请检查我的更新

标签: android google-cloud-messaging google-play-services android-multidex


【解决方案1】:

在你的 build.gradle 中你可以使用这个

compile 'com.google.android.gms:play-services:8.3.0'

因此,删除它并仅使用所需的 API,

检查此链接中的 VicVu 答案, gradle - Android Studio build too slow multidex application

【讨论】:

  • 尝试使用单个 Image Loader API 来减小大小。在这里,您使用的是 squareup 和 Universal 图像加载器
【解决方案2】:

您是否尝试将堆大小调整添加到您的 build.gradle 文件?例如,这会将 dexing 的最大堆大小设置为 4GB,它还将启用 multiDexEnabled 选项。

android {
    ...
    dexOptions {
        javaMaxHeapSize "4g"
    }

defaultConfig {
        multiDexEnabled true
     }
}

【讨论】:

    猜你喜欢
    • 2019-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-20
    • 1970-01-01
    • 1970-01-01
    • 2013-06-12
    • 1970-01-01
    相关资源
    最近更新 更多