2017-08-28 162 views
1

我遇到下列錯誤來:不能訪問com.google.android.gms.internal.aad AAD 類文件未找到火力地堡UI無法訪問AAD

我想這會是一個build.gradle問題。但是我無法在我的構建文件中找到任何看起來不對的東西。

這裏是頂級的build.gradle

buildscript { 
repositories { 
    jcenter() 
} 
dependencies { 
    classpath 'com.android.tools.build:gradle:2.3.3' 
    classpath 'com.google.gms:google-services:3.1.0' 
} 
} 

allprojects { 
repositories { 
    jcenter() 
    maven { 
     url "https://maven.google.com" 
    } 
} 
} 

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

這裏是應用級build.grade:

apply plugin: 'com.android.application' 

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

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
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.+' 
testCompile 'junit:junit:4.12' 
compile 'com.google.firebase:firebase-core:11.2.0' 
compile 'com.firebaseui:firebase-ui-auth:2.3.0' 
compile('com.facebook.android:facebook-android-sdk:4.22.1') 
} 

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

這裏是正試圖把一切活動開始:

protected void onCreate(Bundle savedInstanceState) { 
    setTheme(R.style.SplashTheme); 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_splash); 
    FirebaseAuth auth = FirebaseAuth.getInstance(); 
    if (auth.getCurrentUser() != null) 
    { 
     // already signed in 
     auth.signOut(); 
    } 
    else 
    { 
     //AuthU 
     // not signed in 
     startActivityForResult(
       AuthUI.getInstance() 
         .createSignInIntentBuilder() 
         .setIsSmartLockEnabled(false) 
         .setAvailableProviders(
           Arrays.asList(new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build(), 
             new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build(), 
             new AuthUI.IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER).build())) 
         .build(), 
       RC_SIGN_IN); 
    } 

} 

回答

2

該問題很可能是由於firebase-ui-auth:2.3.0與不兼容造成的。最簡單的解決方法是降級到11.0.4,該版本是兼容firebase-ui-auth:2.3.0

compile 'com.google.firebase:firebase-core:11.0.4' // CHANGED 
compile 'com.firebaseui:firebase-ui-auth:2.3.0' 
compile('com.facebook.android:facebook-android-sdk:4.22.1') 

如果你想堅持11.2.0,你可以彌合2.3.0爲使用版本11.2.0用這些更改:

compile 'com.google.firebase:firebase-core:11.2.0' 
compile 'com.google.firebase:firebase-auth:11.2.0' // ADDED 
compile 'com.google.android.gms:play-services-auth:11.2.0' // ADDED 
compile 'com.firebaseui:firebase-ui-auth:2.3.0' 
compile('com.facebook.android:facebook-android-sdk:4.22.1') 

有關庫版本兼容性的說明,請參見FirebaseUI documentation

+0

嘿鮑勃。我嘗試了頂部代碼部分以及底部,它似乎沒有解決它。 – MackProgramsAlot

+0

@MackProgramsAlot:檢查您的設備/模擬器是否安裝了Google Play服務的兼容版本。如果您的應用初始化時在logcat中看到'W/GooglePlayServicesUtil:Google Play服務已過期'消息,則需要升級Play服務。 –

+0

沒有看到.... – MackProgramsAlot