I am developing an app in such an android device that requires each app to be signed with a specific key, even the testing apk.
I know how to sign an app by configuring build.gradle. But signing testing app (Instrumentation test) seems no such configing, am I missing something ?
Thanks for NateZh and TWL.
Yes, the answer is to add flowing lines to build.gradle
:
signingConfigs {
debug {
keyPassword 'your pw'
storeFile file('your keystore file path')
storePassword 'your pw'
keyAlias 'your alias'
}
}
But, there are more to be take care of:
When using signingConfigs.debug
, this tells gradle it's debug key, no need to specific buildTypes.debug.signingConfig
again
SigingConfigs.debug
also take effect when building instrumentation test
In multi-modules project, if you want to test a module, you should include signingConfigs.debug
in the module's build.gradle
.
For example, my project looks like:
app
-build.gradle
libs
-src/androidTest/java/com/my/MyTest.java
-build.gradle
Adding signingConfigs.debug
to app has no effect when I want to run libs' AndroidDebugTest
. Instead, adding signingConfigs.debug
to libs' build.gradle
do the work.
Hope it's helpful to others.
try this in build.gradle
signingConfigs {
release {
keyPassword 'your pw'
storeFile file('your keystore file path')
storePassword 'your pw'
keyAlias 'your alias'
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
signingConfig signingConfigs.release
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With