Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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? 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. How can I do this?

like image 921
b85411 Avatar asked Dec 05 '16 01:12

b85411


People also ask

What is difference between release and debug APK?

Major differences are the debug apk and the release apk: For debug builds the apk will be signed with the default debug signing keys with debug flag enabled. For release apk you will have to explicitly specify the apk to sign with and the debug flag will be turned off so that it cannot be debugged.


1 Answers

You can config that in your android studio, right click your project, chose the open module settings

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.

like image 184
Jacob Avatar answered Oct 09 '22 11:10

Jacob