Android Studio应用签名花费的时间太长

时间:2019-11-10 09:02:37

标签: java android android-studio gradle

使用Android Studio 3.5.2生成签名的android应用需要花费20多分钟的时间。
以下是我的模块build.gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "my app id"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 13
        versionName "1.4.3"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            debuggable false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'android.arch.lifecycle:extensions:1.1.1'

    implementation 'androidx.recyclerview:recyclerview:1.1.0-rc01'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    implementation 'android.arch.paging:runtime:1.0.1'
    implementation 'android.arch.lifecycle:extensions:1.1.1'

    //google services
    implementation 'com.google.android.gms:play-services-ads:18.3.0'
    // Add the Firebase SDK for Google Analytics
    implementation 'com.google.firebase:firebase-analytics:17.2.1'

    // For example, to use Firebase Authentication and Cloud Firestore
    implementation 'com.google.firebase:firebase-auth:19.1.0'
    implementation 'com.google.firebase:firebase-firestore:21.2.1'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
}
apply plugin: 'com.google.gms.google-services'

我看到了一些建议,例如删除com.google.gms.google-services,但就我而言,由于Firebase,我需要它。

我还在org.gradle.parallel=true中启用了gradle.properties,但问题仍然存在。
无效的缓存重启后,Android Studio仍然需要等待太长时间。
我的机器是Windows 10 RAM,12 GB

1 个答案:

答案 0 :(得分:0)

尝试文件->使缓存无效/重新启动,它对我有用。