minifyEnabled为true时,Android Studio Build卡住了

问题描述 投票:1回答:1

Android Studio生成签名Apk陷入困境

app:transformClassesAndResourcesWithProguardRelease
ExcecuteTransform

当minifyEnabled为false时,它可以工作

我的app.gradle文件

apply plugin: 'com.android.application'


android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.ashishclasses"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 3
        versionName "1.0.2"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            shrinkResources false
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.google.firebase:firebase-firestore:18.0.0'
    implementation 'com.android.support:design:28.0.0'

    implementation 'com.android.support:customtabs:28.0.0'
//    implementation files('libs/YouTubeAndroidPlayerApi.jar')
    implementation "com.vimeo.networking:vimeo-networking:1.1.3"
//    implementation 'com.mcxiaoke.volley:library:1.0.18'
//    implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:9.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
//    implementation 'com.google.firebase:firebase-database:16.0.6'
    implementation 'com.google.firebase:firebase-ads:17.1.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

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

我甚至删除了所有的proguard规则,现在proguard-rules.pro只是空文件

请告诉我如何在启用proguard时构建apk

android-studio android-gradle
1个回答
1
投票

我一直在运行我的构建,最后20分钟后

Gradle build finished in 20 m 45 s 428 ms

所以我的问题解决了但实际上并没有解决。

我签署的apk的简单构建需要1-2分钟,并且启用缩小20分钟

我的硬件也不差,

我有6GB的ram和ssd,并使用arch linux和AMD A8处理器

© www.soinside.com 2019 - 2024. All rights reserved.