【问题标题】:Android Studio stuck on :app:transformdexarchivewithdexmergerfordebug after migrating to androidx while building the gradleAndroid Studio 在构建 gradle 时迁移到 androidx 后卡在 :app:transformdexarchivewithdexmergerfordebug
【发布时间】:2019-06-27 14:58:54
【问题描述】:

我迁移到 AndroidX,从那以后我无法在模拟器上运行我的应用程序,我也无法生成 .apk 或 app bundle,因为 android studio 卡住了

:app:transformdexarchivewithdexmergerfordebug 在构建应用程序时。

我尝试删除 multidex 并启用它,但仍然没有成功

这是我的应用程序 gradle 文件

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
    applicationId "com.example"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 100
    versionName "1.0.0"
    vectorDrawables.useSupportLibrary = true
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

lintOptions {
    checkReleaseBuilds false
    // Or, if you prefer, you can continue to check for errors in release builds,
    // but continue the build even when errors are found:
    abortOnError false
}

}

dependencies {
def lifecycle_version = "1.1.1"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0'
implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0@aar'
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
implementation 'com.github.iammert:MaterialIntroView:1.5.2'
implementation 'com.github.mreram:showcaseview:1.1'
implementation 'id.zelory:compressor:2.1.0'
implementation 'com.github.hkk595:Resizer:v1.5'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.firebase:firebase-database:18.0.0'
implementation 'com.google.firebase:firebase-storage:18.0.0'
implementation "com.google.android.gms:play-services-auth-api-phone:17.0.0"
implementation 'com.firebaseui:firebase-ui-auth:3.2.2'
implementation 'com.firebaseui:firebase-ui-database:4.2.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.facebook.android:facebook-login:4.35.0'
implementation 'com.twitter.sdk.android:twitter:3.1.1'
implementation 'com.twitter.sdk.android:twitter-mopub:3.1.1'
implementation 'com.twitter.sdk.android:twitter-core:3.1.1'
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
implementation group: 'androidx.lifecycle', name: 'lifecycle-viewmodel-ktx', version: '2.1.0-alpha04'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.facebook.android:account-kit-sdk:4.39.0'
implementation name: 'sinch-android-verification-1.6.0', ext: 'aar'
implementation 'com.github.joielechong:countrycodepicker:2.3.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'com.google.firebase:firebase-ads:18.0.0'
implementation 'com.google.android.gms:play-services-ads:18.0.0'
implementation 'com.firebase:firebase-client-android:2.5.0'
implementation 'com.iceteck.silicompressorr:silicompressor:2.2.2'
implementation 'com.google.android.exoplayer:exoplayer:2.7.2'
// Add the dependency for the Performance Monitoring library
implementation 'com.google.firebase:firebase-perf:18.0.1'
implementation 'com.instabug.library:instabug:8.4.0'

}
apply plugin: 'com.google.gms.google-services'

我已尝试使缓存无效并重新启动,还删除了 .gradle/caches/ 中的缓存,但问题仍然存在。 Android Studio 自 3 小时以来一直停留在 :app:transformdexarchivewithdexmergerfordebug 并且没有构建项目。

有人可以帮我怎么做才能成功构建我的项目吗?

【问题讨论】:

  • 我面临着完全相同的问题。你的是我找到的唯一参考。我上周才开始迁移。如果/何时找到修复程序,请告诉我。

标签: androidx android-studio-3.4


【解决方案1】:

我昨天在我的项目中解决了这个问题。当您使用--debug--stacktrace 从命令行构建时,您会发现Gradle 内存不足。我的javaMaxHeapSize 设置为8g,但这似乎不起作用(或问题)。

将其设置为 2048M 并删除 com.google.firebase:firebase-perf 似乎可以解决问题。我建议您将dexOptions 中的javaMaxHeapSize 设置为2048M 并尝试构建。

【讨论】:

  • 感谢 javaMaxHeapSize 的建议!在尝试了许多值之后; javaMaxHeapSize "8g" 终于为我工作了。
【解决方案2】:

删除 firebase-performance 为我解决了这个问题。

【讨论】:

    猜你喜欢
    • 2019-11-02
    • 2019-09-26
    • 1970-01-01
    • 2019-11-29
    • 2019-11-09
    • 1970-01-01
    • 2019-12-25
    • 2020-01-27
    • 1970-01-01
    相关资源
    最近更新 更多