尝试通过Google,Facebook,电话和电子邮件在我的应用中建立身份验证 Google工作正常,Facebook尚未尝试,电话和电子邮件都给出了相同的错误。
public class MainActivity extends AppCompatActivity
implements View.OnClickListener{
private static final String TAG = MainActivity.class.getSimpleName();
private FirebaseAuth mAuth;
private static final int RC_SIGN_IN = 200;
private List<AuthUI.IdpConfig> providers;
private AuthUI mAuthUI;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAuth = FirebaseAuth.getInstance();
mAuthUI = AuthUI.getInstance();
if(isUserLogged()){loginUser();}
setContentView(R.layout.activity_main);
findViewById(R.id.SiginInActivity).setOnClickListener(this);//btn listener
providers = Arrays.asList(
new AuthUI.IdpConfig.PhoneBuilder().build(),
new AuthUI.IdpConfig.EmailBuilder().build(),
new AuthUI.IdpConfig.GoogleBuilder().build(),
new AuthUI.IdpConfig.FacebookBuilder().build());
}
@Override
public void onClick(View view)
{
switch (view.getId())
{
case R.id.SiginInActivity:
startActivityForResult(
mAuthUI.createSignInIntentBuilder()
.setIsSmartLockEnabled(false,true)
.setAvailableProviders(providers)
.build(),
RC_SIGN_IN);
}
}
设置智能锁与否不能解决问题,这里是gradle / app文件
`
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.undetermined.golf"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "
android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), `'proguard-rules.pro'`
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-
布局:1.1.3' 实施'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.firebaseui:firebase-ui-auth:4.2.1'
implementation 'com.firebaseui:firebase-ui-database:4.2.1'
implementation 'com.firebaseui:firebase-ui-firestore:4.2.1'
implementation 'com.facebook.android:facebook-login:4.38.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-`core:3.0.2'`
}
android {
defaultConfig {
resConfigs "en"
}
}
apply plugin: 'com.google.gms.google-services'`
这是项目/等级l
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they
belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这里是logCat:从我单击使用电子邮件按钮登录的时间起
2018-12-04 21:29:37.227 1899-1984/system_process W/InputDispatcher: channel '4ce8804 com.example.undetermined.golf/com.example.undetermined.golf.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
2018-12-04 21:29:37.227 1899-1984/system_process E/InputDispatcher: channel '4ce8804 com.example.undetermined.golf/com.example.undetermined.golf.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2018-12-04 21:29:37.244 1899-5088/system_process I/WindowManager: WIN DEATH: Window{4ce8804 u0 com.example.undetermined.golf/com.example.undetermined.golf.MainActivity}
2018-12-04 21:29:37.244 1899-5088/system_process W/InputDispatcher: Attempted to unregister already unregistered input channel '4ce8804 com.example.undetermined.golf/com.example.undetermined.golf.MainActivity (server)'
我黑屏了,如果重新尝试崩溃,它会被发送回mainactivity。