Android 中的发布与调试版本差异 [英] Release vs debug build differences in Android

查看:36
本文介绍了Android 中的发布与调试版本差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有,我们面临一个奇怪的问题,即我们的应用程序在调试构建变体中运行良好.但是它无法在发布构建变体上正确执行.更奇怪的是,如果我们将发布构建变体的 debuggable 设置为 true,它就可以正常工作.Proguard 在这两种变体中都被禁用.

All, we are facing a weird issue where our app is working fine in a debug build variant. But it is failing to execute properly on a release build variant. The even weird thing is that if we set debuggable to true for the release build variant, it works fine. Proguard is disabled in both variants.

我试图了解 android 中发布和调试构建变体之间的区别.你能给我指出任何有助于我理解差异的资源吗?

Im trying to understand what is the difference between the release and debug build variants in android. could you point me to any resources which helps me to understand the differences ?

谢谢

以下有效.但是如果我删除了可调试的,它就无法正常工作.调试构建始终有效.

The following works. But if i remove the debuggable, it fails to work properly. Debug build always works.

buildTypes {
    release {
        debuggable true
        signingConfig signingConfigs.release
    }
    debug {
        signingConfig signingConfigs.debug
    }
}

推荐答案

可能与apk的签名有关.如果您使用 debuggable true,那么您的应用程序将使用通用调试密钥库进行签名,并且一切正常.相反,如果您将其删除,则必须提供

Maybe the problem is related to the signing of the apk. If you use debuggable true then your app is signed with a generic debug keystore and everything works correctly. Conversely, if you remove it you have to provide

storeFile file("myreleasekey.keystore")
storePassword "password"
keyAlias "MyReleaseKey"
keyPassword "password"

更多信息在这里:

https://developer.android.com/studio/build/build-variants.html#build-types

这篇关于Android 中的发布与调试版本差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆