I tried to sign my new android app using data from some old keystore named "keystore.keystore". It couldn't recover key so I deleted that keystore from disk and created a new one, named "keystore.jks".
Then I added the following to build.gradle, following guide from page https://developer.android.com/studio/build/build-variants#signing:
signingConfigs {
release {
storeFile file("C:\\SomeDirectory\\keystore.jks")
storePassword "mypassword123"
keyAlias "key"
keyPassword "mypassword123"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Then I went to Build / Generate Signed Bundle/APK menu option in Android Studio. It didn't pick information about keystore, key or alias from the above build.gradle file, so I entered it again manually in the dialog window.
After pressing Next, the task completed with the following error:
"C:\SomeDirectory\keystore.keystore (The system cannot find the file specified)".
Notice the name of the keystore, it's the old name. Where does it come from???
So I opened cmd.exe and ran this: "gradlew.bat assembleRelease". There was similar error:
Task :app:packageRelease FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:packageRelease'. java.io.FileNotFoundException: C:\SomeDirectory\keystore.keystore (The system cannot find the file specified)
Invalidating caches/restarting doesn't help.
Why is gradle referring to the old keystore name, how to make it use the new keystore?
gradlew clean
will make gradle use the new one
I faced the same issue today.
What worked for me was to delete the app/build/intermediates/signing_config/release/out/signing-config.json
file between builds (I don't know why this works).
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