首页 > 解决方案 > 将 debuggable 设置为 false 时,发布构建运行方式不同

问题描述

在 Android Studio 中,在Module Settings -> Build Types中,debuggable设置为false。我像这样运行发布版本,现在我的程序表现不同,并且不能按照我想要的方式工作。奇怪的是,当我运行相同的发布版本但debuggable设置为true时,程序运行正常(当构建变体设置为调试时我最初构建程序的方式)。

为什么我的程序会这样?

在我最初的调试版本中,游戏的整个屏幕都有一个ImageView响应onTouch事件的按钮。在该onTouch方法中,它首先检查是否启用了用户输入,如果是,则处理它(这似乎在某些时候不起作用)

构建梯度:

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.dark_maze_signature
        debuggable false
    }
    debug {
        debuggable true
    }
}

依赖项:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
    implementation 'com.google.android.gms:play-services-identity:15.0.1'
    implementation 'com.google.android.gms:play-services-games:15.0.1'
    implementation 'com.google.android.gms:play-services-ads:15.0.1'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    testImplementation 'junit:junit:4.12'
    implementation 'com.google.android.gms:play-services-games:15.0.1'
    implementation 'com.unity3d.ads:unity-ads:2.2.0'
    implementation 'com.google.ads.mediation:unity:2.2.0.0'
    implementation('com.vungle:publisher-sdk-android:5.3.2@aar') {
    transitive = true
    }
    implementation 'com.google.ads.mediation:vungle:5.3.2.1'
}

标签: javaandroidandroid-gradle-plugin

解决方案


推荐阅读