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

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

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

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Q&A

解決済

1回答

11865閲覧

ビルド時にManifest merger failed with multiple errorsエラーが発生

takaradango

総合スコア8

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

0グッド

2クリップ

投稿2019/10/04 08:56

前提・実現したいこと

androidのプッシュ機能を使うためにfirebaseを実装しようと思い、以下のサイトを参考に環境設定をしました。
https://blog.codecamp.jp/programming-first-android-app-development
その際に以下のようなエラーが発生しました。

発生している問題・エラーメッセージ

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:6:5-20:19 to override.

最後の指示通り、「tools:replace="android:appComponentFactory」をManifest.xmlに加えところ、次は以下のようなエラーメッセージが出てきました。

Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple errors, see logs

以下のサイトが同じような状況でしたが、「compile 'com.google.android.gms:play-services-ads:8.1.0'」が見つからず自分のケースには適用することができませんでした。
https://teratail.com/questions/50380
プロジェクトとモジュールのbuild.gradleのソースコードとManifest.xmlのソースコードは以下のようになっています。

該当のソースコード

build.gradle(プロジェクト)

// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.3.0' classpath 'com.google.gms:google-services:4.3.2' // 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 }

build.gradle(app)

apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "com.example.yoriai.mysecondapp" minSdkVersion 21 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 fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.google.firebase:firebase-analytics:17.2.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' 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' } apply plugin: 'com.google.gms.google-services'

Manifest.xml

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.yoriai.mysecondapp"> <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> </manifest>

宜しくお願いします。

試したこと

ここに問題に対して試したことを記載してください。

補足情報(FW/ツールのバージョンなど)

ここにより詳細な情報を記載してください。

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

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

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

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

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

guest

回答1

0

ベストアンサー

firebase-analytics:17.2.0 が依存しているAndroidXと、プロジェクトが依存している旧サポートライブラリとで衝突が起きています。以下のいずれかの方法でサポートライブラリを統一するようにしてください。

  • AndroidXに移行する

ドキュメント: https://developer.android.com/jetpack/androidx/migrate

  • firebase-analyticsのバージョンを下げる

17.0.0からAndroidXに移行したようなので、それ未満に下げてください。

投稿2019/10/07 03:13

kakajika

総合スコア3131

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

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

takaradango

2019/10/08 06:31

単純にandroidstudioのバージョンが古かったせいでした。 kakajikaさんのおかげで気付けました!ありがとうございます。 ベストアンサーにさせていただきます!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問