- Android Keystore Manager
- Creating a new keystore
- Choosing your keystore location
- Loading an existing keystore within the Keystore Manager
- Adding a new key to an existing keystore
- Unity Android, использующий Facebook SDK, отсутствует Debug Android KeyHash
- Android SDK setup #426
- Comments
- konradkozaczenko commented Apr 7, 2020
- albermotion commented Jun 18, 2020
- plasmanunchucks commented Jul 22, 2020
- albermotion commented Jul 22, 2020
- konradkozaczenko commented Jul 23, 2020
- nick-dodonov commented Oct 26, 2020 •
- Getting Started with the Facebook SDK for Android
- Quick Start
- Android Studio Setup
- Add Your Facebook App ID and Client Token
- Sending Images or Videos
- Running Sample Apps
- Create a Development Key Hash
- Create a Release Key Hash
- Use the Facebook SDK for Android with Maven
- Troubleshooting Sample Apps
Android Keystore Manager
The Keystore Manager is a window which allows you to create, configure or load Android keystores An Android system that lets you store cryptographic key entries for enhanced device security. More info
See in Glossary and keys. For further information see Android’s Keys, Certificates and Keystores documentation.
To open the Keystore Manager, open the Android publishing window and select the Keystore Manager button.
Keystore Manager Window
Property | Description |
---|---|
Keystore dropdown | Use the Keystore dropdown to create a new keystore or select an existing one. Select Create New to create a new keystore. Select Anywhere to save the keystore file in your Project folder, or In Dedicated Location to create and save it to a different directory. Select Select Existing > Browse to select a keystore you already have. See Choosing your keystore location for more details. |
Password | Enter your keystore password. If you are creating a new keystore, use this field to create a password. |
Confirm Password (only required when you create a new keystore) | Use this to confirm the password for your new keystore. |
Existing keys | The Keystore Manager window automatically populates the Existing Keys field when you load an existing keystore into your project. |
New Key Values | If you have created a new key, you need to complete these fields. If you have loaded existing keys, you do not need to complete these fields. The New Key Values fields request the same information that Android Studio requests when you generate a key or keystore. This information is not displayed in your app, but is included in your certificate as part of the Android Package (APK). For further information, see Android’s Generate an upload key and keystore documentation. Unity does not validate this information. If you leave these fields blank, Unity uses empty values. This might affect the validity of your key. |
Alias | Enter an identifying name for your key. |
Password | Choose and enter a password for your key. |
Confirm password | Enter the password for your key again. |
Validity (years) | Enter an amount of time (in years) that your key is valid for. This should exceed the amount of time you expect to manage your application for, so that you can use the same key to sign application updates. The default validity is 25 years. |
First and Last Name | Enter your first and last name. |
Organizational Unit | Enter your organizational unit. Organizational units are the different divisions within an organization. For example: Android development team. |
Organization | Enter the organization that manages your application. For example: your company name. |
City or Locality | Enter your city or locality. |
State or Province | Enter your state or province. |
Country Code | Enter your country code. |
Note: You cannot change this keystore, key or certificate information once you sign your Android app.
Creating a new keystore
Use the Keystore dropdown to create a new keystore.
- From inside the dropdown, click Create New.
- Select Anywhere or In Dedicated Location.
- Enter a password in Keystore password.
- Re-enter the password in Confirm password.
Creating a new keystore automatically creates a new key. Fill in the New Key fields in the keystore manager.
Choosing your keystore location
When you create a new keystore, the storage location you choose changes the default location that Unity opens your file explorer in to save your file. You can still change this after the file explorer opens. — Choose Anywhere to open the file explorer. By default, Unity stores your keystore inside your project folder. However, you can store this anywhere on your machine. If you store your keystore outside of your project folder, Unity saves an absolute path. — Choose In Dedicated Location to open the file explorer in a custom default location. By default, this path points to $HOME/ on MacOS and to %USER_HOME%\ on Windows.
To define a new project-wide dedicated location, go to Unity > Preferences > External Tools > Android > Keystores Dedicated Location, then click Browse to select a location or enter a path in the text box.
If you store a keystore to a dedicated location, Unity saves a relative path. This relative path is equal to the dedicated location paths on other machines. Therefore, the folders don’t need to be in the same place on both machines.
Note that if you save the new keystore outside of your project folder or a shared directory, collaborators on your project might not have access to it.
Loading an existing keystore within the Keystore Manager
Use the Keystore dropdown to load an existing keystore.
- Select Select Existing.
- Select Browse to load a keystore from your file system, or select a keystore stored in a Dedicated Location from below the partition.
- Enter the password in Keystore password.
- Select Load Keys.
If you have multiple keys in your keystore, select a key for your project in the Android Publishing Settings Project Key fields.
Note: You can also choose an existing keystore directly from the Android Publishing Settings, without using the Keystore Manager window.
Adding a new key to an existing keystore
Use the following steps to store multiple keys in a keystore.
- Load an existing keystore (see Loading an existing keystore within the Keystore Manager).
- Fill in the New Key Values.
- Select Add Key. A Key and Keystore Created dialogue window appears.
- Select the new key as your project key.
Источник
Unity Android, использующий Facebook SDK, отсутствует Debug Android KeyHash
Спасибо всем заблаговременно,
Я следил за этой документацией:
И это конкретное видео для интеграции facebook в Android:
Но Unity не заполняет (как в видео) поле «Debug Android Key Hash», которое я должен вставить в свое приложение для facebook.
Снимок экрана проблемы
- Unity 4.2
- Jdk1.7.0_25 (с переменной окружения Path)
- Все версии sdk для Android
- Openssl (в C: \ openssl)
Я попытался создать файл «debug.keystore» вручную с помощью cmd.exe ( Facebook Android Generate Key Hash ) с помощью keytool и переместил его в «C:\Users\(My UserName)\.android» , но Unity не обнаружил, что Ключевой хеш.
Может кто-нибудь мне помочь? Я застрял…
Я использовал это решение Facebook Android Generate Key Hash для создания debug.keystore, переместился в «C:\Users\(My UserName)\.android» и использовал этот ключ на facebook
Сценарий в редакторе Unity попытается запустить:
keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64
(Или эквивалент mac, если вы на Mac)
Из вашей команды, похоже, у вас должен быть ключ:
(Обратите внимание на папки)
Или если у вас несколько жестких дисков и у вас нет вашего дома на вашем основном диске, переместите debug.android туда, куда указывает ваш домашний путь перемещения.
Другое дело – обеспечить, чтобы и keytool, и openssl находились на вашем пути. Вы можете вручную выполнить их в оболочке. Если он не сможет их найти, добавьте их в свой PATH.
Источник
Android SDK setup #426
Comments
konradkozaczenko commented Apr 7, 2020
With Unity 2019.3, that value is not set anymore when the » Installed with Unity» checkbox is selected. In result, although my sdk path is correct, I can see warning in Facebook Settings «You don’t have the Android SDK setup!»
The text was updated successfully, but these errors were encountered:
albermotion commented Jun 18, 2020
Bump, this is annoying and should be fixed
plasmanunchucks commented Jul 22, 2020
Android SDK Tools installed via Unity Hub are located in your editor. Try unchecking ‘Installed with Unity’ and entering that path (mine is C:\Program Files\Unity\2019.2.7f2\Editor\Data\PlaybackEngines\AndroidPlayer\SDK)
albermotion commented Jul 22, 2020
Android SDK Tools installed via Unity Hub are located in your editor. Try unchecking ‘Installed with Unity’ and entering that path (mine is C:\Program Files\Unity\2019.2.7f2\Editor\Data\PlaybackEngines\AndroidPlayer\SDK)
That works, but it should be fixed anyway
konradkozaczenko commented Jul 23, 2020
Android SDK Tools installed via Unity Hub are located in your editor. Try unchecking ‘Installed with Unity’ and entering that path (mine is C:\Program Files\Unity\2019.2.7f2\Editor\Data\PlaybackEngines\AndroidPlayer\SDK)
That works, but it should be fixed anyway
Yeah, that works but it’s just a workaround. In fact, then you can check «installed with unity» again but in EditorPrefs there still will be saved value from input field. This is confusing, specially for new developers
nick-dodonov commented Oct 26, 2020 •
Even new v8.1.0 version tries to obtain SDK incorrectly when Embedded SDK Check is marked.
Value in EditorPrefs for «AndroidSdkRoot» can be set to custom anyway.
Here’s is my workaround to get rid of the error message about SDK during build (GPGS plugin obtains real embedded values the same way):
Источник
Getting Started with the Facebook SDK for Android
This documentation explains how to get started integrating your Android app with Facebook by using the Facebook SDK for Android. The current version of the Facebook SDK for Android is version 12.0.0 and requires the Android API 15. For more information about versions and features, see Facebook SDK for Android.
Beginning with SDK v13.0, set to release in early 2022, a Client Token will be required for all calls to the Graph API.
You can set up your app to use the Facebook SDK for Android in the following ways:
- By using the Quick Start.
- By setting up your project with the Facebook SDK for Android.
Quick Start
To get a Facebook App ID, configure your app’s settings, and import the Facebook SDK for Android, click on the button below and follow the instructions.
Android Studio Setup
To use the Facebook SDK in an Android Studio project, add the SDK as a build dependency and import the SDK.
- Go to Android Studio | New Project | Minimum SDK.
- Select API 15: Android 4.0.3 (IceCreamSandwich) or higher and create your new project.
- After you create a new project, open Gradle Scripts | build.gradle (Project: and do the following:
- Add the following to the buildscript < repositories <>> section of the build.gradle (Project) file:
- Save and close build.gradle (Project: ) .
- Open Gradle Scripts | build.gradle (Module: app) and do the following:
- Add the following to the dependencies <> section of your build.gradle (module: app) file to compile the latest version of the Facebook SDK for Android:
When you use the Facebook SDK, some events in your app are automatically logged and collected unless you disable automatic event logging. For details about what information is collected and how to disable automatic event logging, see Automatic App Event Logging.
Add Your Facebook App ID and Client Token
Add your Facebook App ID and Client Token to your project’s strings file and update your Android manifest:
1. Open your /app/res/values/strings.xml file.
2. Add a string element with the name attribute facebook_app_id and value as your Facebook App ID to the file. For example
3. Open /app/manifests/AndroidManifest.xml
4. Add a uses-permission element to the manifest:
5. Add a meta-data element to the application element:
Sending Images or Videos
If you’re sharing links, images or video via the Facebook for Android app, you also need to declare the FacebookContentProvider in the manifest.
Append your app id to the end of the authorities value. For example if your Facebook app id is 1234 , the declaration looks like:
Running Sample Apps
The following samples come with the Facebook SDK for Android:
- HelloFacebookSample — Demonstrates profile access, status updates and photo upload.
- RPSSample — Use Native Share Dialog, Open Graph publishing, pickers, invites, and deep linking.
- Scrumptious — Login, requests, pickers, picture uploads, and Open Graph publishing.
You can experiment with samples by importing the Facebook SDK into an Android Studio project. The samples have a project dependency rather than a central repository dependency via maven central or jcenter. This is so that when a local copy of the SDK gets updates, the samples reflect the changes.
To run samples apps quickly, you can generate key hashes for your development environments. Add these to your Facebook developer profile for the sample apps. Keytool, for generating the key hashes, is included with the Java SE Development Kit (JDK) that you installed as part of setting up your development environment. OpenSSL is available for download from OpenSSL.
On Windows, you need the following:
Run the following command in a command prompt in the Java SDK folder. This generates a 28 character string.
Go to the Facebook Developer site. Log into Facebook and, using the dropdown menu in the top-right, go to Developer Settings:
In your developer settings, select Sample App from the menu, and add and save your key hash into your profile:
You can add multiple key hashes if you develop with multiple machines.
You can now compile and run all of the samples — including those that use Facebook Login.
Create a Development Key Hash
Facebook uses the key hash to authenticate interactions between your app and the Facebook app. If you run apps that use Facebook Login, you need to add your Android development key hash to your Facebook developer profile.
For the version of your app that you release to you also need to generate and set a Release Key Hash.
On either OS X or Windows you can get a key hash by generating it or by using the value returned by Settings.getApplicationSignature(Context) . For instructions, see Running Sample Apps .
Create a Release Key Hash
To authenticate the exchange of information between your app and the Facebook, you need to generate a release key hash and add this to the Android settings within your Facebook App ID. Without this, your Facebook integration may not work properly when you release your app to the store.
In a previous step, you should have updated your Facebook Developer Settings with the key hashes for your development environments.
When publishing your app, it is typically signed with a different signature to your development environment. Therefore, you want to make sure you create a Release Key Hash and add this to the Android settings for Facebook App ID.
To generate a hash of your release key, run the following command on Mac or Windows substituting your release key alias and the path to your keystore.
On Windows, you need the following:
Run the following command in a command prompt in the Java SDK folder:
Make sure to use the password that you set when you first created the release key.
This command should generate a 28 characher string. Copy and paste this Release Key Hash into your Facebook App ID’s Android settings.
You should also check that your Facebook App ID’s Android setting also contain the correct package name and main activity class for your Android package.
Use the Facebook SDK for Android with Maven
You can declare the Maven dependency with the latest available version of the Facebook SDK for Android.
Troubleshooting Sample Apps
If you have a problem running a sample app, it may be related to the key hash. You may see one of the following scenarios:
- A native Login Dialog appears but after accepting the permissions you are still in a logged out state. The logcat also contains an exception:
- A non-native Login Dialog appears with an error message: »..App is Misconfigured for facebook login. ».
Check your key hash and you can make sure you use the correct key hash. I
You can also manually modify the sample code to use the right key hash. For example in HelloFacebookSampleActivity class make a temporary change to the onCreate() :
Save your changes and re-run the sample. Check your logcat output for a message similar to this:
Save the key hash in your developer profile. Re-run the samples and verify that you can log in successfully.
Источник
- Add the following to the dependencies <> section of your build.gradle (module: app) file to compile the latest version of the Facebook SDK for Android: