简体   繁体   English

如何使用与发布APK相同的密钥对debug APK进行签名-Android Studio

[英]How to sign debug APK's with the same key as release APK's - Android Studio

I want to test in-app purchasing within my app, but it seems impossible to do this with a regular debug APK through Android Studio? 我想在我的应用程序中测试应用程序内购买,但是用Android Studio的常规调试APK似乎无法做到这一点? Has anyone done this before and if so what steps did you take to do it? 有人做过此事吗?如果是,您采取了哪些步骤?

I was thinking to get around it I should try signing my debug APK's in the same way I sign my release APK's. 我当时想解决这个问题,我应该尝试用与我的发行版APK相同的方式对我的调试APK进行签名。 How can I do this? 我怎样才能做到这一点?

You can config that in your android studio, right click your project, chose the open module settings 您可以在android studio中进行配置,右键单击您的项目,选择打开模块设置

Or if you are crazy about the hand-writen build scripts, here is a snapshot of code: 或者,如果您对手写的构建脚本感到疯狂,请看下面的代码快照:

android {
  signingConfigs {
    release {
      storeFile file(project.property("MyProject.signing") + ".keystore")
      storePassword "${storePassword}"
      keyAlias "${keyAlias}"
      keyPassword "${keyPassword}"
    }
  }

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

Just config your debug and release build type with same signingConfig . 只需使用相同的signingConfig配置调试和发布构建类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM