I have an Android app certificate with a file type of FILE that was created back in 2012 for my Android app written in Java. Now I have updated that app using React Native.
How can I use the existing certificate to generate keystore and sign my updated app to be released on Google Play?
I've tried this even though the React Native certificate extension is .keystore
keytool -importcert -file "your.cer" -keystore your.jks -alias "<anything>"
and I got the following error
keytool error: java.lang.Exception: Input not an X.509 certificate
I expect to have a .keystore file that allows me to release an update of my existing Android app.
You don't need to create keystore file. you can use existing jks file to sign the app. Do as follow:
Put your jks file in the app directory
add the following code in your gradle.poperties file.
MYAPP_RELEASE_STORE_FILE=filename.jks
MYAPP_RELEASE_KEY_ALIAS=your-key-alias
MYAPP_RELEASE_STORE_PASSWORD=your-store-password
MYAPP_RELEASE_KEY_PASSWORD=your-release-key-password
Now add the signingConfigs in build.gradle file as below:
signingConfigs{
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
Now you can sing your using your existing jks file.
One thing missed from the accepted answer.
How to fetch the existing Keystore file from the expo?
expo fetch:android:keystore
I need to know this so hopefully, it'll help someone.
Related
I made this Android app that fetches some data using AI Platform Training & Prediction API from Google Cloud Platform. For this app to work it needs to be approved by GCP using SHA-1 Fingerprint certificate. I am making this app as an assessment for module Im taking at the university, so, when the teacher will open my Android Studio project it will have a different SHA-1, so the app will not fetch the data...
Any Ideas how I might be able to maybe set a permanent SHA-1 key for my project, so when the teacher will open the project, Android Studio will not generate a new one?
Thank you!
The SHA-1 is based on the app signature. Since this is for a project I suggest you do the following (never do this in a production app).
Create a new signing key (Build -> Generate Signed Apk -> APK ->
Create New)
Move the signing key to your project's folder
Add this to your app.gradle
android {
signingConfigs {
debug{
storeFile file("your_key.keystore")
storePassword 'password'
keyAlias 'alias'
keyPassword 'password'
}
release {
storeFile file("your_key.keystore")
storePassword 'password'
keyAlias 'alias'
keyPassword 'password'
}
}
}
EDIT: Forgot to mention, run the signingReport gradle task after you do this to get your new SHA-1 that you have to add to your project.
after creating the .keystore file and running the report I get the new SHA-1 key, but the build fails. I get this:
Entry name 'play-services-ads-identifier.properties' collided
I currently new developing android react-native, I have problem regarding deploying my application on other mobile device, I read the documentation of react native How to generate signed APK, i did the instruction of there document
React Native signed-apk-android
I already done configuring those requirements based on there document. I will show you the step that I did.
First: Install this in the cmd
keytool -genkeypair -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
Second: Setting up gradle variables
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=123456
MYAPP_RELEASE_KEY_PASSWORD=123456
Third: Adding signing config to your app's gradle config
...
android {
...
defaultConfig { ... }
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
buildTypes {
release {
...
signingConfig signingConfigs.release
}
}
}
...
Lastly: Generating the release APK
Simply run the following in a terminal:
$ cd android
$ ./gradlew assembleRelease
Before I do the installation, I gonna make sure that the package
clearly uninstalled on my mobile device.
Release APK:
Error:
you need to click on the apk (probably with developer mode active press a few times on the build number in the settings menu)
I try to upload APK file generated by gradle. It is a react-native application signed with keytool. Keystore generated by react-native tutorial command.
I tried to create universal apk and to change some configs, but I haven't found a solution yet.
You uploaded an APK that is not signed with the upload certificate. You must use the same certificate. The upload certificate has fingerprint:
[ SHA1: 4B:23:5D:33:EA:53:95:97:A4:D3:02:56:B0:BF:80:00:0A:E6:E1:B5 ]
and the certificate used to sign the APK you uploaded have fingerprint:
[ SHA1: 6E:C3:AC:AF:03:7C:3D:AB:37:E7:4D:19:EF:9C:38:65:6D:46:DB:D0 ]
gradle.properties:
MYAPP_RELEASE_STORE_FILE=my-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-alias
MYAPP_RELEASE_STORE_PASSWORD=***
MYAPP_RELEASE_KEY_PASSWORD=***
build.gradle:
.....
signingConfigs {
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
.....
The Problem is your key is not matched with old key
Old Key
You should give correct path of .jks file (which is already created on first time apk upload playstore)
New key
Generate signed apk then upload.
On the menu bar, click Build > Generate Signed APK/Bundle.
Refer SignedAPK
I am trying implement In-App billing in my Androd app and when I test the purchase functionality I get the error "This version of the application is not configured for billing through Google Play."
I suspect that I did not properly generate a signed APK and that the problem is with my buil.gradle file.
I genereated a keystore by following the instructions here and generated .jks. My question is what exactly do I put for the storeFile file() in signingConfigs?
The following example is from the Android docs:
signingConfigs {
release {
storeFile file("myreleasekey.keystore")
storePassword "password"
keyAlias "MyReleaseKey"
keyPassword "password"
}
}
Simply putting the path to my .jks file didn't work. Is a .jks file different than a .keystore file? If so, how do I genereate a .keystore?
UPDATE
I learned that the .keystore and .jks are arbitrary file extensions from this answer.
My plan is to simply copy the my keystore.jks file in to the app directory then add the tag as follows:
storeFile file("keystore.jks")
Is this correct? Unfortunately it will take a few hours for the apk to be published by Google Play so I can't get a quick answer on this.
I solved the problem. The key was to choose the app directory as the key store path.
Here are detailed instructions on how I generated a signed apk in Android Studio:
Go to Build->Generate Signed apk
Select the app module, click next.
Under Key store path, click create new.
The following window will pop up.
Select your app directory for the keystore path. It will create a keystore with default name "keystore.jks". You can change it if you like.
Enter a password for the keystore. We will call it "StorePassword"
Enter a Key Alias (let's call it "KeyAlias") and a Key password (let's call it "KeyPassword")
In the build.gradle file add the following:
Example Signing config:
signingConfigs {
release {
storeFile file("keystore.jks")
storePassword "StorePassword"
keyAlias "KeyAlias"
keyPassword "KeyPassword"
}
}
Continue through the Generate Signed apk Wizard and enter in the appropriate passwords and generate the apk. The key is to make sure that the build.gradle is updated in the final signed apk.
To confirm that you successfully signed the .apk see this question.
And of course, have secure backups and be extremely protective of the keystore once it is genereated.
keytool -genkey -v -keystore name_of_your_file.keystore -alias your_alias -keyalg RSA -keysize 2048 -validity 10000
This is command will generate new keys
change name_of_your_file for your name
and your_alias for your alias
the keystore will be generated in folder where you call this
Then add this to your build.gradle
signingConfigs {
config {
storeFile file("${rootDir}/name_of_your_file.keystore")
storePassword "qwerty"
keyAlias "your_alias"
keyPassword "qwerty"
}
}
buildTypes {
release {
signingConfig android.signingConfigs.config
}
}
but change qwerty to your password
and your_alias to your alias name which you use when you generate keystore
and name_of_your_file to name of your kestore
clean your project and run ./gradlew task assembleRelease
In Android Studio go to Build->Generate Signed apk and follow steps. You don't need to add signingConfigsin build.gradle At least on current android studio version which is 1.3.2
I'm developing some applications that need system UID. So I made a special keystore file "PFDebug.keystore" made from AOSP's platform.pk8 and platform.x509.pem.
I set it in Eclipse >window >preferences >android >build >cutstom debug keystore. That works fine.
But I am also developing non-privileged applications that use my own debug.keystore file. So I have to change keystore file for each build. I know that default debug.keystore is used when I set blank.
How can I bind debug keystore files for each android project?
It's doable with gradle.
For each project you have a build.gradle in which you can specify a signingConfig. Like that :
signingConfigs {
debug {
storeFile file("../debug.keystore")
}
release {
storeFile file("../prod.keystore")
storePassword 'prod'
keyAlias 'prod'
keyPassword 'prod'
}
}