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

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

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

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

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Q&A

0回答

393閲覧

Android Studio Firebaseを追加したときのエラー

uhsi

総合スコア57

Firebase

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

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

0グッド

0クリップ

投稿2019/09/03 12:35

以下の説明の通りに設定したのですがエラーが発生しました。どのように解決したらよいのでしょうか。
https://blog.codecamp.jp/programming-first-android-app-development

イメージ説明

apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 28 defaultConfig { multiDexEnabled true applicationId "com.example.XXX" minSdkVersion 16 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } dependencies { implementation 'com.google.firebase:firebase-messaging:20.0.0' implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.multidex:multidex:2.0.1' implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.google.firebase:firebase-core:17.2.0' implementation 'com.google.firebase:firebase-firestore:21.0.0' 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' }
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.XXX"> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <application tools:replace="android:appComponentFactory" android:appComponentFactory="whateverString" 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> <service android:name=".MyFirebaseMessagingService" android:exported="false"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service> </application> </manifest>

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

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

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

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

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

keicha_hrs

2019/09/03 15:18

「以下の説明の通り」と記されていますが、説明通りになっていないように思えます。"apply plugin: 'com.google.gms.google-services'"はbuild.gradleの末尾に置くように記述されています。また、Firebaseのライブラリーを最新版とするならば、AndroidXを用いる必要があるでしょう。ご提示のコードは従来のSupport Libraryのままになっているので、その部分でエラーになっているのかもしれません。
uhsi

2019/09/03 22:36

ありがとうございます。AndroidXを使用しない方法で行いたいのですが、その場合バージョンはどのようにすれば良いのでしょうか。
keicha_hrs

2019/09/03 22:56

https://firebase.google.com/support/release-notes/android このページにFirebaseのリリースノートがあります。"Update - June 17, 2019"の更新によってAndroidXに移行しているので、その下の方を辿って移行前のバージョンを探すことになるんじゃないでしょうか。
uhsi

2019/09/04 07:52

解決しました。ありがとうございました。
keicha_hrs

2019/09/04 12:17

解決されたのであれば、そこに至った内容を自己回答して、それをベストアンサーとしてください。ただ、AndroidXを用いないということは、今後のGoogle APIやFirebaseの更新を一切利用できないことを意味します。今は参考にしたページと異なる要因を増やしたくないなどの理由があるのかもしれませんが、いずれAndroidXは避けて通れないものと考えておくべきだと思います。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

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

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

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問