1

我迁移到 AndroidX,从那以后我无法在模拟器上运行我的应用程序,我也无法生成 .apk 或应用程序包,因为 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 工作室自 3 小时以来一直停留在 :app:transformdexarchivewithdexmergerfordebug 上,并且没有构建项目。

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

4

2 回答 2

3

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

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

于 2019-07-11T08:51:45.767 回答
0

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

于 2019-09-12T13:44:38.510 回答