I want to use google plus authentication in my cordova app.
1. Generate keystore
keytool -genkey -v -keystore <keystoreName>.keystore -alias <Keystore AliasName> -keyalg <Key algorithm> -keysize <Key size> -validity <Key Validity in Days>
2. Create android release version
cordova build android --release
3. Sign My Apk
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore <keystoreName>.keystore android-release-unsigned.apk <alias>
4. Optimize my APK
zipalign -v 4 android-release-unsigned.apk <output name>.apk
5. ADD android app in: http://console.firebase.google.com.
6. Get hash from my keystore
keytool -exportcert -keystore <keystoreName>.keystore -list -v -alias <alias>
7. Add SHA1 hash for my adroid app
8. After that i can see client id for android in: https://console.developers.google.com/apis/credentials?project=
9. I'm install this plugin: https://github.com/EddyVerbruggen/cordova-plugin-googleplus.
10. My code in app:
window.plugins.googleplus.getSigningCertificateFingerprint(
function (fingerprint) {
alert(fingerprint); // SHA1 HASH - It's same like in console.firebase.google.com
}
);
window.plugins.googleplus.login(
{
'scopes': '',
'webClientId': '62......39.6-..................jjka5b...v87q7.apps.googleusercontent.com', // optional clientId of your Web application from Credentials settings of your project - On Android, this MUST be included to get an idToken. On iOS, it is not required.
'offline': true,
},
function (obj) {
alert(JSON.stringify(obj));
},
function (msg) {
alert('error: ' + msg); // error 10
}
);
I'm install apk on my android device and always get error 10.
I installed and successfully use facebook plugin for cordova. It's work good! But i can't solve problem with google. What am I doing wrong?
Can anybody help me...
I regenerated keystore... Reinstall cordova... Reinstall googlepus plugin...
My problem solved!!!
I use clientID "Web client (auto created by Google Service)" instead of clientID "Android client for com.android.app (auto created by Google Service)". It's work! I get token and user data!
In my case, I was getting this error because I was trying to log-in from within the Emulator. This fails because the the emulator installs the app-debug.apk which does not have proper SHA1 fingerprints, unlike the signed apk or aab ( bundle ).
I installed the signed version I generated from Android Studio and installed that to a actual device which made it work.
Related
I'm trying to test google in app purchase system.
If I download from the app from google play, in app purchase works.
However if I run the app directly from android studio, I can't because of error code 5 or 0.
I think its because when running through android studio on test device its not signed. how do i do that ?
You need to sign it manually with your production keystore:
jarsigner -sigalg MD5withRSA -digestalg SHA1 -keystore "PATH" -storepass KEYSTORE_FILE app-unsigned.apk ALIAS_NAME
Then you maybe need to zipalign:
zipalign "-v" "4" "PATH TO SIGNED APK" out.apk
Error:
com.google.firebase.auth.FirebaseAuthException: This app is not authorized to use Firebase Authentication. Please verifythat the correct package name and SHA-1 are configured in the Firebase Console. [ App validation failed ]
You must re-generate SHA-1 by using your keystore, which is used to sign your APK. Then add generated SHA-1 to your firebase project configure.
For example: your keystore is: abc.keystore. Let run below statement to generate SHA-1
keytool -exportcert -alias <your_keystore_alias> -keystore <path_to_file>/abc.keystore -list -v -storepass android
Then copy the output SHA-1 in console and add to settings of your Firebase project
Try running below command in command prompt:
keytool -exportcert -alias <your_keystore_alias> -keystore <path_to_file>/key_name.keystore -list -v -storepass android
Once SHA-1 is generated, set it in Firebase console.
Note JAVA_HOME has to be set on Path variable in System Settings.
I generated a apk file by running
meteor build ~/output-dir --server=myapp.meteor.com
,
then got release-unsigned.apk in the folder output-dir, it looks good.
I copy this apk file to my Android phone and tried to install it, after install guide, it shows message App not installed.
I have installed some apk files built by java on my phone before, it works, so is there something I need handle when I install apk file built by meteor?
As the documentation states, you can't install unsigned applications on your Android phone:
Android requires that all apps be digitally signed with a certificate
before they can be installed.
As far as I can tell, you have the following two options to run your app:
Use an emulator to run your unsigned app or
sign your app.
To sign your app, you can use the steps, described in the Meteor guide for submitting Android apps to the Play Store:
Generate a private key using the keytool (skip this step, in case you already have a private key generated):
keytool -genkey -alias your-app-name -keyalg RSA -keysize 2048 -validity 10000
Sign your app using the jarsigner tool:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 unaligned.apk your-app-name
After that, you should be able to install and run your application on your Android phone.
I have written an Android app (target 3.2) using Eclipse 3.7, I tried to sign the App, but on the target machine, either the App won't install or it installed but doesn't run with "application is not installed" error. In debug mode the app works fine with the temporary certificate.
I checked the App with jarsigner and it has CertPath not validated: null errors.
I have also set the Manifest parameter debuggable and test only to false.
With the keytool I use the following command line -:
keytool -genkey -v -keystore vgpad.keystore -alias alias_name -sigalg SHA1withDSA -keyalg DSA -keysize 1024 -validity 10000
then for the Jarsigner
jarsigner -keystore D:\dev\Java\jdk1.7.0_02\bin\vgpad.keystore -sigalg SHA1withDSA -digestalg SHA1 -storepass puffin -keypass puffin V-G-Pad.apk alias_name
I have used various different options and also tried from Eclipse, export signed app... still the same error. Any help would be welcome, thanks.
Manifest must contain the minsdk version and maxsdkversion
There is another way to sign up the application.
Right Click on Project -->Select "Android Tools" Option --> "Export Signed Application Package"
in that select project --> create new .keystore file validity(years) = 50
later install that signed apk by using
command prompt from your device with following command
adb install yoursignedapk.apk
this signed apk will successfully install on your device
In fact I solved this using two actions,
resorting to the Java 1.6.0.30 JDK, I was using the 1.7 before, this solved the key and signing issues.
Ensured in the manifest I had only the android.permission.WRITE_EXTERNAL_STORAGE once, before the application tag
This was after using the adb logcat command to see the lancher issues :
Permission Denial: starting Intent {.... } requires
android.permission.WRITE_EXTERNAL_STORAGE
I developed a Android App and could sign it with the Eclipse Plugin, but i wanted to sign it manually with jarsigner and zipalign, so that i can choose the algorithm and the keysize by my self.
I created a Keystore with this command:
keytool -genkey -v -keystore keystore_name -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
My first issue is that i cant enter the Keystore with the Eclipse Plugin. It says:
Keystore was tampered with, or password was incorrect
So i went on with the jarsigner like this:
jarsigner -verbose -keystore keystore_name my_application.apk alias_name
and it works fine.
finally i run the tool zipaling:
zipalign -v 4 inputfile.apk outputfile.apk
I could publish my app in the market without any trouble. But when a friend downloaded my app, he gets the error: Package file was not signed correctly
Furthermore I can't install my app signed manually. But the version, signed with the Eclipse plugin works fine.
The big problem now I have is, that I can't upload the new apk file do the market, because it says that it is signed with an other certificate.
What can I do ?
Not sure if this will help but I came across a similar issue before. After trying a few things I used jarsigner like this and it has been working fine:
jarsigner -verbose -digestalg SHA1 -sigalg MD5withRSA -keystore %path to key store here% -signedjar %the name you want for your signed apk here% %the apk you want to sign here% your.keystore
EDIT:
Just noticed your question was about what to do with the app on the market place. I'm no help there. Sorry.
Verify the keytool you are using:
which keytool
check if it is set to openjdk... Android supports only Sun/Oracle Java as the keytool.