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

问题描述

全部, 我们面临一个奇怪的问题,即我们的应用在调试版本中运行良好.但是它无法在发行版本上正确执行. 甚至很奇怪的是,如果我们为release build变量将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中的release和debug build变体之间有什么区别.您能给我指出任何有助于我理解差异的资源吗?

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中版本与调试版本之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 12:49