在构建gradle迁移到androidx之后,Android Studio卡在:app:transformdexarchivewithdexmergerfordebug上

时间:2019-06-27 14:58:54

标签: androidx android-studio-3.4

我迁移到AndroidX,此后我无法在模拟器上运行我的应用程序,因为android studio卡在了我上,所以我无法生成.apk或应用程序包

:app:在构建应用程序时,使用dexmergerfordebug进行转换。

我试图删除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 /中的缓存,但是问题仍然存在。自3个小时以来,Android Studio一直停留在:app:transformdexarchivewithdexmergerfordebug上,并且未构建项目。

有人可以帮我做什么,以便我的项目成功建立吗?

2 个答案:

答案 0 :(得分:2)

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

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

答案 1 :(得分:0)

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