Debug a self signed android app? (Need it for facebook integration) - android

When hitting the "debug"-button in eclipse my App gets signed by a debug key form android which is stored in the file "debug.keystore".
Now I am implementing the Facebook SDK which forces me to use a signed app for the Single SignOn feature. That way I need to generate the hash of my companies keystore and store the one in our facebook developer account.
I know how to sign an app through the wizard in Eclipse (over the AndroidManifest.xml). How to debug such a signed app?
Can I change the debug key somehow and set up our companies key as debug key? Or how should I go? Right now I can get FB working only by signing and installing my app on a device. I already tried to generate a hash of the debug key with no luck...

Just in case anyone wants to
change the debug key somehow and set up our companies key as debug key
as the original poster asks, you can do so using keytool as so:
STORE_PASS=<pass_of_company_store>
ALIAS=<alias_of_key_in_company_store>
ALIAS_PASS=<pass_alias>
keytool -importkeystore -v -noprompt \
-srckeystore /path/to/company/key -destkeystore debug.keystore \
-srcstorepass $STORE_PASS -deststorepass android \
-srcalias $ALIAS -destalias androiddebugkey \
-srckeypass $ALIAS_PASS -destkeypass android
You can then replace your debug (perhaps ~/.android/debug.keystore) with the new one that this generates, and eclipse will happily use it to build apks that can be fully debugged and accepted by facebook.
Note that you have to be very careful with this new debug.keystore. It cannot fall into the wrong hands or your app can easily be hijacked on the Google Play Store.

I do not recommend setting your companies key as your debug key, but you can do that by replacing the Eclipse debug keystore file, named debug.keystore. You can find its location on your OS by reading through this.
A better solution would be to generate the hash of the debug key - follow the instructions given on the official SDK for Android page, and make sure you mention the correct keystore file, and the alias "androiddebugkey". The password is always "android".

Related

Unsigned apk vs signed apk Google Map not showing

I have done an Android app which takes the data from a server database.
If I install it from an USB installation or installing an unsigned apk everything works properly but, if I install it from a signed apk (or downloading it from PlayStore) the maps activity does not work.
Once I have installed it, my app does a request to an API in order to take the data in its database an fill the app's db so I can show the data from the app db.
I know it is getting the data since I can see everything allright but maps Activity, which looks like following:
USB/Unsigned apk:
Signed apk:
Does anyone know if there is any diferent between these two apks that may be causing this unexpected behavior?
Thanks in advance
You need to create a Release key with your keystore file and password for Signed Apk
Then u have to add the key in developer console
Step 1
in command prompt:
keytool -list -v -keystore /home/rafsan/Desktop/Android/Projects/TestApp/keystore.jks -alias test -storepass password -keypass password
where
/home/rafsan/Desktop/Android/Projects/TestApp/keystore.jks is the path where your keystore file for the signed apk is present
test is the key alias name used while genrating the signed key store
and password is the password used while signing the apk
Step 2
Go to Developer console
and add the release key with package
A3:33:EA:3D:5E:....................85;com.example.package_name
Do you generate release certificate ? Check here.I think this solve your problem.
You have created a Maps API key with your debug certificate but not with your release one.
Follow the steps here and get a new key
https://developers.google.com/maps/documentation/android-api/

Facebook, hash key generated properly but is being accepted

I am using following command to generate my has key.
keytool -exportcert -alias <ALIAS> -keystore <PATH TO KEYSTORE> | "F:\api\openssl\bin\openssl.exe" sha1 -binary | "F:\api\openssl\bin\openssl.exe" base64
both the ALIAS and PATH TO KEYSTORE are same as the ones i use while exporting my application. Also the password I give is also the same i use while exporting my app.
I have properly updated the key on facebook on both dev n release options.
How ever when i try to share from my app it shows me a Toast containing following error:
(#404)Key hash <A COMPLETELY NEW HASH> does not match any stored key hashes.
Can anybody help me.
It generally means the app Id of that app you are using that doesn't have same hash key that you are using....
my solution would be
1.Create completely new app on Facebook and get new app id.
2.Generate hash key properly with your own debug.keystore file and put it into Facebook app
I was facing the same issue after doing this i got rid from
(#404)Key hash does not match any stored key hashes.
I might be repeating things you already know, but you need to add multiple key hashes to your app settings if you're doing development and release.
In general, when you're exporting your app (to put on the Play Store, for example), you're using the release keystore, whereas when you're doing development (building from IntelliJ or Android Studio), you're using the debug keystore. You need to put the key hash from both of these keystores in your app settings.

Unity Facebook SDK for Android. App keeps asking permissions

The problem is that when the app is requesting permissions you get this popup but if you click ok nothing happens and this popup keeps coming up as if it does not get user permission.
If I sign the app as a debug user through these settings it DOES WORK
But obviously for the final build I have to sign the app with my normal alias. What could the problem be?
I also found out that the debug hashkey keeps changing when I change between keystores and it could be an openssl problem. I get a different key from Mac to Win and a different key if I get it from the Facebook settings or the -keytool command. Is there a way to know the actual hashkey?
You need to add all the hashkeys that you're gonna use when signing the app to the FacebookApp settings page. You can set up more than one and you'll need this if you're gonna sign the app with debug keys and release keys.
Debug keys may differ from machine to machine so it's better to just distribute the keystore with your Unity3D project and use the same one everywhere you build the project.
If you don't want to distribute the release keys you may want to consider setting up a build machine.
To get the hashes for a keystore you need to run:
keytool -exportcert -alias keyalias -keystore path_to_keystore | openssl sha1 -binary | openssl base64

After exporting apk the Google Maps do not show in application. Why does it happen?

I am using Google Maps V1 API key. If i Itaking the apk from bin folder, the Google Maps will shown in application. But if I export the project and deploy the exorted apk the google maps do not show in the application. If anybody knows the reason, kindly share your thoughts. Thank you.
When you develop and run an application locally, you are actually signing it with a debug key.
When you export, you are signing it with a different, production key.
Google Maps requires your api key to match the key you sign your app with. So you will need 2 different api keys depending on whether your apk was made via debug key (copying it from "bin") or production (exporting).
What's happening to you is when you export your app, the key is not matching what Google Maps API thinks it should be, so it's not working.
Read more about signing apps here.
Please follow these steps to get Release SHA1
Find your .jks path which is used while creating signed apk.
Ex: /Users/dharm/Documents/Android/test.jks
Copy your jks file name and put in the end of line number 3
Ex: test.jks
Open your terminal and enter this command keytool -list -v -keystore "keystorepath" -alias "keyalias"
Ex: keytool -list -v -keystore /Users/dharm/Documents/Android/test.jks -alias test
When you will press enter it will ask for Enter keystore password. So please enter your key store password.
If you do all the steps successfully then you will get entire information of this certificate(key store).
Ex:
MD5: D2:52:A1:7C:14:9F:D5:DD:64:35:E2:3F:74:CA:C5:E7
SHA1: D3:32:AA:09:81:71:50:D2:47:20:43:B2:13:A2:D5:55:4B:A7:DC:3C
SHA256:
27:8A:84:C5:C3:CE:98:47:A7:73:E2:87:91:5E:5A:A2:F4:B8:D4:D4:0E
Now you can put this SHA1 key on google console( SHA-1 certificate fingerprint).
Hope it will help you.
For Video Kindly have a look on it
https://www.youtube.com/watch?v=g75cZXjmuj8&feature=youtu.be
I put the key directly in the manifest and began to work.

Phonegap non debug mode and signing with license key

I've completed a app in phonegap and would like to publish this on the google app store. Every time I download the apk file its in debug mode. How do I go about signing it with a key or keystore to get this to upload into google play as google will not upload it into my account in debug mode.
I'm doing something wrong but can not see how in build.phonegap.com you can sign the app?
Please help
Thanks
Use this command from the terminal or command prompt to generate keystore file:
keytool -genkey -v -keystore myAppKey.keystore -alias myAppKey -keyalg RSA -validity 10000
This will generate myAppKey.keystore file.
That you have to upload at build.phonegap.com site under your application settings.
There you will get signing settings so add your keystore and then select that signing key for your application.
By this phonegap will regenerate android builds and you will get APK which will be used to publish in the google play market.
REFERENCE :
how Google suggests creating an Android keystore
Getting the illegal option too - something about copy/pasting from the post above is causing that. If you delete the '-' characters and type them manually using the '-' on your keyboard then it works :)

Categories

Resources