我已将自己从Eclipse转移到Android Studio.现在我正在尝试使用我的地图应用程序.所以我需要我的SHA-1指纹证书号码.
当我使用Eclipse时,它正好在Windows - > Preferences - > Android - > Build下.但是在Android Studio中,我找不到这样的选项,以便我可以轻松找到指纹.我正在使用Windows.我从这个链接中读到:
当您从IDE运行或调试项目时,Android Studio会自动以调试模式签署您的应用程序.
所以我尝试在从此链接设置我的Java bin路径后在命令行中运行它,但遗憾的是找不到我的指纹.据说这是非法的选择.
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
Run Code Online (Sandbox Code Playgroud)
有没有办法从Android Studio中找到SHA-1指纹,就像在Eclipse中一样容易?由于我是Android Studio中的新手,找到它的完整过程是什么?
我想要添加的另一件事是我让我的Eclipse生成SHA-1指纹,之前我在Google开发者控制台中将该应用程序注册在该指纹上,并且我通过该API密钥在Eclipse中使用该应用程序.在Android Studio中我的项目是否可以使用相同的API密钥?
当我尝试在模拟器上运行我的应用程序时,我收到此错误.
我做了什么:
事实上,当我在真实设备上运行应用程序时,它运行完美,我可以登录.
This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console.
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. Is app running on a physical device? ]
at com.google.android.gms.internal.jz.zzK(Unknown Source:239)
at com.google.android.gms.internal.kp.zza(Unknown Source:2)
at com.google.android.gms.internal.kq.run(Unknown Source:37)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98) …Run Code Online (Sandbox Code Playgroud) 我最近更新了 firebase 库,没有改变任何其他东西。
implementation 'com.google.firebase:firebase-auth:20.0.1'
implementation 'com.google.firebase:firebase-messaging:21.0.0'
implementation 'com.google.firebase:firebase-storage:19.2.0'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
Run Code Online (Sandbox Code Playgroud)
但是每当用户尝试注册时,Recaptcha 都会显示几秒钟,然后有时会在从 firebase auth 收到 OTP 后重定向到网络浏览器 (CustomChromeTab)。大约需要 15-30 秒。如何防止 Recaptcha?但是,我在 firebase 控制台中添加了 SHA1 和 SHA256,并且没有更改代码。谢谢。
这是验证码验证过程的屏幕截图:
我正面临着一些不同类型的问题.我在我的应用程序中使用Firebase Mobile编号身份验证.当我尝试将OTP发送到我正在使用的同一个手机号码时,OTP不会发送.但是,如果我从我的移动OTP向其他手机发送OTP正在发送.我还发现如果我从其他手机发送OTP到我的号码OTP即将到来.因此,没有手机号码的问题.在调试时我发现这个代码块不起作用
@Override
public void onCodeSent(String verificationId, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
super.onCodeSent(verificationId, forceResendingToken);
Log.e(TAG, "onCodeSent: s - " + verificationId + " : t - " + forceResendingToken);
xVerificationId = verificationId;
}
Run Code Online (Sandbox Code Playgroud)
对于其他数字,它正在工作,验证和forceResendingToken正在生成.
我制作了一个使用Firebase功能的聊天应用程序Real-time database。我在使用Google身份验证时遇到问题。当我从Play商店下载应用程序时,问题开始了,当我在调试模式下运行应用程序时,身份验证工作正常。当用户尝试登录时,他们会收到一条敬酒消息code:10 message:10。
我想在这里指出:我已经添加了SHA1指纹。我该如何解决?
*不确定这是否有帮助,但本教程已逐步进行
我正在Android应用程序中实现Firebase AuthUI的标准教程。但是,在测试时,我尝试从应用程序内部使用Google登录进行登录,并收到以下异常:
com.google.firebase.FirebaseException: An internal error has occurred.
[ Requests from this Android client application com.xxx are blocked. ]
Run Code Online (Sandbox Code Playgroud)
该应用程序会显示“ Google SmartLock”横幅,就像它在登录我一样,但随后消失了,在日志猫中,我看到了上面的错误。
我验证了Firebase控制台中用于调试和发布的SHA-1证书指纹。我已经在此应用程序中使用了一段时间,所以我知道它们是正确的。
我已经在Firebase身份验证控制台上启用了Google登录和电子邮件登录。我已经尝试了电子邮件/谷歌登录和这两个过程都开始了,但是由于相同的异常而失败了。我还下载并使用了一个新的google-services.json文件-不变。
应用程序名称正确。他们为什么要阻止我?有人有运气联系Firebase支持人员吗?
这是build.gradle的片段:
api 'com.android.support:support-v4:27.1.1'
api 'com.android.support:appcompat-v7:27.1.1'
api 'com.android.support.constraint:constraint-layout:1.1.2'
api 'com.google.firebase:firebase-storage:16.0.1'
api 'com.google.firebase:firebase-core:16.0.1'
api 'com.google.android.gms:play-services-maps:15.0.1'
api 'com.google.android.gms:play-services-location:15.0.1'
api 'com.google.android.gms:play-services-ads:15.0.1'
api 'com.google.code.findbugs:jsr305:3.0.2'
api 'com.google.apis:google-api-services-storage:v1-rev68-1.21.0'
implementation 'com.firebaseui:firebase-ui-storage:0.6.0'
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
testImplementation 'junit:junit:4.12'
Run Code Online (Sandbox Code Playgroud)
Logcat:
/com.x.x W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@13ca6fd
/com.x.x D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=12629, firebase_screen_class(_sc)=PhotoActivity, firebase_screen_id(_si)=-1316627329056180637}]
/com.x.x D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=PhotoActivity, firebase_previous_id(_pi)=-1316627329056180637, …Run Code Online (Sandbox Code Playgroud) 我在Mac El Capitan上使用Android Studio.如何获得发布证书指纹?我需要它用于Firebase.我不确定如何得到它.
如何修复 Firebase 身份验证错误?我生成了我的应用程序的发布版 APK,它在用户可以正常登录的设备上运行良好。
然后,当我在 Play 商店上发布了相同的工作 APK 并从那里(playstore)安装时,就会出现问题。我得到的错误是
该应用无权使用 Firebase 身份验证。请确认在 firebase 控制台中配置了包名称和 SHA1
android push-notification google-play firebase firebase-authentication
嗨,我正在尝试使用Firebase在android中进行电话身份验证。第一次安装该应用程序时,短信会出现,并且验证成功,但随后短信不会再出现。我已从Firebase中的auth删除用户,但仍无法正常工作。
以下是我的代码。
MainActivity.java
public class MainActivity extends AppCompatActivity {
CountryCodePicker ccp;
EditText editTextPhone, editTextCode;
FirebaseAuth mAuth;
String codeSent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mAuth = FirebaseAuth.getInstance();
editTextCode = findViewById(R.id.editTextCode);
editTextPhone = findViewById(R.id.editTextPhone);
findViewById(R.id.buttonGetVerificationCode).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendVerificationCode();
}
});
findViewById(R.id.buttonSignIn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
verifySignInCode();
}
});
}
private void verifySignInCode() {
String code = editTextCode.getText().toString();
PhoneAuthCredential credential = PhoneAuthProvider.getCredential(codeSent, code);
signInWithPhoneAuthCredential(credential);
}
private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) { …Run Code Online (Sandbox Code Playgroud) 我第一次尝试使用实时数据库。设定值功能对我不起作用。
我已经通过以下方式更新了写作规则:
{
"rules": {
".read": true,
".write": true
}
}
Run Code Online (Sandbox Code Playgroud)
我的代码如下所示:
Integer Age = 24;
FirebaseDatabase mDatabase = FirebaseDatabase.getInstance();
DatabaseReference sReference = mDatabase.getReference();
sReference.child("Users").child("George").child("Age").setValue(Age)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(Dashboard.this, "Data stored", Toast.LENGTH_LONG).show();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(Dashboard.this, "Error", Toast.LENGTH_LONG).show();
}
});
Run Code Online (Sandbox Code Playgroud)
当我打印出参考时,它是正确的。然而, OnSucces 和 OnFailure 都不会被触发。
感谢您的帮助。