By default, the Android build system uses a keystore in $HOME/.android/debug.keystore.
If that file does not exist already at build time, it will be automatically generated. So most likely the app is being signed with a completely different keystore on your machine and on the Jenkins machine.
You can resolve this by copying the keystore from your machine to the Jenkins machine, to the user $HOME directory that Jenkins runs as.
Alternatively, you can override the default build system behaviour by explicitly supplying a keystore to use when building a debug version of the app.
This means that, no matter user on which machine builds the app, the same debug keystore will always be used to sign the APK.
For example, you can add a new signingConfig to app/build.gradle:
signingConfigs { debug { // Override the local debug keystore, so that // all builds have consistent certificates storeFile file('../debug.keystore') } }
This assumes that you've created and checked-in a debug keystore at the root of your project.
This debug keystore must have the same key alias and password as the ones that the Android build system generates, i.e. alias androiddebugkey, password android.
You can use keytool to generate a key with these properties:
keytool -genkey -v -keyalg RSA -keysize 2048 -validity 10000 \ -dname 'CN=Android Debug,O=Android,C=US' -keystore debug.keystore \ -storepass android -alias androiddebugkey -keypass android