質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.47%
Firebase

Firebaseは、Googleが提供するBasSサービスの一つ。リアルタイム通知可能、並びにアクセス制御ができるオブジェクトデータベース機能を備えます。さらに認証機能、アプリケーションのログ解析機能などの利用も可能です。

Kotlin

Kotlinは、ジェットブレインズ社のアンドリー・ブレスラフ、ドミトリー・ジェメロフが開発した、 静的型付けのオブジェクト指向プログラミング言語です。

Authentication

Authentication(認証)は正当性を認証する為の工程です。ログイン処理等で使われます。

Q&A

1回答

2686閲覧

Firebase Authenticationの実装(Google認証) getString(R.string.default_web_client_id)エラー

yukari00

総合スコア5

Firebase

Firebaseは、Googleが提供するBasSサービスの一つ。リアルタイム通知可能、並びにアクセス制御ができるオブジェクトデータベース機能を備えます。さらに認証機能、アプリケーションのログ解析機能などの利用も可能です。

Kotlin

Kotlinは、ジェットブレインズ社のアンドリー・ブレスラフ、ドミトリー・ジェメロフが開発した、 静的型付けのオブジェクト指向プログラミング言語です。

Authentication

Authentication(認証)は正当性を認証する為の工程です。ログイン処理等で使われます。

0グッド

0クリップ

投稿2020/05/15 12:20

前提・実現したいこと(

グーグルアカウントを用いた認証をするために
Android で Google ログインを使用して認証する
Firebase Authenticationの実装(Android, Google認証)
上記のサイトを見ながらコード入力をしていました。

しかし以下のコードでエラーが発生しました。

private fun configureGoogleSignIn() { mGoogleSignInOptions = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build() mGoogleSignInClient = GoogleSignIn.getClient(this, mGoogleSignInOptions) }

default_web_client_idがunresolved referenceと出たので、調べたところgoogle-services.jsonの配置とbuild.gradleの記述が間違っているときにエラーがでるらしいのですが、確認しても間違いが見当たりません。
もし原因がわかる方いらっしゃいましたら、教えていただきたいです。

build.gradle(app)

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 29 buildToolsVersion "29.0.3" defaultConfig { applicationId "com.example.diaryapplication" minSdkVersion 21 targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } // To inline the bytecode built with JVM target 1.8 into // bytecode that is being built with JVM target 1.6. (e.g. navArgs) compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = "1.8" } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.core:core-ktx:1.2.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.google.android.material:material:1.1.0' implementation 'androidx.navigation:navigation-ui-ktx:2.2.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' implementation 'androidx.gridlayout:gridlayout:1.0.0' implementation 'com.google.firebase:firebase-analytics:17.4.1' implementation 'com.google.firebase:firebase-database:19.3.0' //noinspection GradleCompatible implementation 'com.android.support:cardview-v7:28.0.0' //noinspection GradleCompatible implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.google.android.gms:play-services-auth:18.0.0' implementation 'com.google.firebase:firebase-core:17.4.1' implementation 'com.google.firebase:firebase-auth:19.3.1' implementation 'com.google.android.gms:play-services-auth:18.0.0' implementation 'com.google.firebase:firebase-firestore:21.4.3' //play service auth implementation 'com.google.android.gms:play-services-auth:18.0.0' } apply plugin: 'com.google.gms.google-services'

build.gradle(Project)

// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = '1.3.61' repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.6.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.3.3' // 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 }

google-services.jsonの設置位置も間違っていないはずです…

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

同じことでエラーが起きたのでいろいろ試しているうちに
[implementation 'com.firebaseui:firebase-ui-auth:6.2.1']
をbuild.gradle(:app)に同期させると解決できました。
初心者なので確信はなのですが、良かったら試してみてください。

投稿2020/10/12 11:48

okiokity23

総合スコア2

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.47%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問