0

It is my understanding that debug builds are automatically signed with the debug keystore by default.

I'd like a debug build that is unsigned, for various reasons. I am aware of various solutions to sign debug builds, but that is not what I am looking for.

We are using gradle.

I am aware that creating another release type/flavors will result in an unsigned apk, but that is not what I am asking for.

Again, I am asking, is it possible to create the default debug build, but simply unsigned?

Danedo
  • 2,193
  • 5
  • 29
  • 37

1 Answers1

0

Maxim G's comment referencing another question:

Export unsigned apk from a Gradle Project in Android Studio

lead me to a comment to one of the answers:

The output folder only had debug signed apk for me. This post is how I got a truly unsigned apk: entzeroth.com/export-unsigned-android-apk – Keith Entzeroth

The linked site lead me to the answer, which I suppose I should've figured out myself:

debug {
    signingConfig null
}

Hopefully it is self explaning why this yields an unsigned debug build. I think it is redundant to specify this for other builds, as there is no default signing configuration, only for debug, I think.

In practice, I am doing something slightly different:

if (project.hasProperty('debug_force_unsign') && 
                property('debug_force_unsign') == 'true') {
    debug {
        signingConfig null
    }
}

The property 'debug_force_unsign' simply allows me to specify exactly when I want the debug build to be unsigned, which is typically only for debug builds created on my build machine. I execute:

gradlew clean assembleDebug -Pdebug_force_unsign=true

to force the debug build to be unsigned. I then sign it at a later step. If I didn't do this, my debug builds would be unsigned on my dev machine, and I wouldn't be able to easily install them. Basically, it would break the process that happens when I press the RUN button on my IDE, and slow things down.

There are perhaps easier ways to do this entire process, but this solves my current predicament.

Community
  • 1
  • 1
Danedo
  • 2,193
  • 5
  • 29
  • 37