2017-10-17 36 views
0

私のアプリにFirebaseUI認証を追加しようとしていますが、ひどく悩んでいます。私は自分のアプリでFacebook、Twitter、電話番号の確認を追加しましたが、それは私にエラー:Cannot resolve method setAvailableProvidersCannot resolve symbol IdpConfigを与えています。このエラーを解決するには、アプリで何をすべきですか?画像には、エラーと赤い線があることがわかります。ここメソッドsetAvailableProvidersを解決できません。シンボルIdpConfigを解決できません。

は私のmanifest.xmlです:ここ

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.anonymous.userlogin"> 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:roundIcon="@mipmap/ic_launcher_round" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 
     <activity android:name=".MainActivity"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 
    <uses-permission android:name="android.permission.INTERNET"/> 

</manifest> 

私のGradleファイル

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 

    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.3' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
     classpath 'com.google.gms:google-services:3.0.0' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     maven { url 'https://maven.fabric.io/public' } 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

はここに私のGradleファイルされる:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.2" 
    defaultConfig { 
     applicationId "com.example.anonymous.userlogin" 
     minSdkVersion 16 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    //compile 'com.android.support:appcompat-v7:26.+' 
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    //android authentication dependicies. 
    compile 'com.google.firebase:firebase-auth:10.0.1' 
    //android login with fb tw ph user nterface dependices 

    compile 'com.firebaseui:firebase-ui-auth:0.6.0' 
    //compile 'com.firebaseui:firebase-ui-auth:3.0.0' 
    //facebook dependicies 
    compile 'com.facebook.android:facebook-login:4.27.0' 
    //twitter dependicies 
    compile("com.twitter.sdk.android:twitter-core:[email protected]") { transitive = true } 
    testCompile 'junit:junit:4.12' 
} 


apply plugin: 'com.google.gms.google-services' 

configurations.all { 
    resolutionStrategy.eachDependency { DependencyResolveDetails details -> 
     def requested = details.requested 
     if (requested.group == 'com.android.support') { 
      if (!requested.name.startsWith("multidex")) { 
       details.useVersion '26.0.0-alpha1' 
      } 
     } 
    } 
} 

ここでは、私のメインのコードですアクティビティ

package com.example.anonymous.userlogin; 
import android.support.v7.app.AppCompatActivity; 
import android.os.Bundle; 
import com.firebase.ui.auth.AuthUI; 
import com.google.firebase.auth.FirebaseAuth; 
import java.util.Arrays; 
public class MainActivity extends AppCompatActivity { 
    private static final int RC_SIGN_IN = 123; 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 
     FirebaseAuth auth = FirebaseAuth.getInstance(); 
     if (auth.getCurrentUser() != null) 
      {} 
     else 
      { 
      // not signed in 
       startActivityForResult(
         AuthUI.getInstance() 
           .createSignInIntentBuilder() 
           .setAvailableProviders(
             Arrays.asList(new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build(), 
               new AuthUI.IdpConfig.Builder(AuthUI.PHONE_VERIFICATION_PROVIDER).build(), 
               new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build(), 
               new AuthUI.IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER).build(), 
               new AuthUI.IdpConfig.Builder(AuthUI.TWITTER_PROVIDER).build())) 
           .build(), 
         RC_SIGN_IN); 




      } 
    } 
} 

ここでフラグが立てられたエラーのスクリーンショットです:

enter image description here

答えて

0

あなたがこの機能を持っていないFirebaseUI認証(com.firebaseui:firebase-ui-auth)のバージョン0.6.0を使用しています。代わりに、バージョン2.xまたは3.xを使用する必要があります。

compile 'com.firebaseui:firebase-ui-auth:0.6.0' 
//compile 'com.firebaseui:firebase-ui-auth:3.0.0' 

これに:このアプリのbuild.gradleファイルの変更で

compile 'com.firebaseui:firebase-ui-auth:3.0.0' 
関連する問題