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

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

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

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

Kotlin

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

API

APIはApplication Programming Interfaceの略です。APIはプログラムにリクエストされるサービスがどのように動作するかを、デベロッパーが定めたものです。

Q&A

解決済

1回答

8966閲覧

kotlin: Execution failed for task ':app:checkDebugDuplicateClasses'.

Kotaro22

総合スコア21

Android Studio

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

Kotlin

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

API

APIはApplication Programming Interfaceの略です。APIはプログラムにリクエストされるサービスがどのように動作するかを、デベロッパーが定めたものです。

0グッド

0クリップ

投稿2019/07/27 07:34

E/FirebaseInstanceId: Google Play services missing or without correct permission. E/FirebaseInstanceId: Google Play services missing or without correct permission. E/FirebaseInstanceId: Google Play services missing or without correct permission. E/ActivityThread: Failed to find provider info for com.google.android.gms.phenotype

compileSdkVersion 29 と buildToolsVersion "29.0.0"で作成したプロジェクトをAPI 21でも動作する様に設定しエミュレータデバイスをRUNするとデバイス、プロジェクトは共に動くのですが上記のエラーがLog catに表示されました(プロジェクトのlayoutはconstraintをちゃんと設定しているのに位置やフォントが何故か部分的に崩れている。)。自身でエラーへの対応を調べbuildGradle(Module: app)のdependenciesにGoogle play servicesを追加・syncしてmanifest fileに

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

を追加したのですが以下のエラーが出現してデバイスも起動しなくなりました。どうすればエラーを解消出来るか考えあぐねているのですがアドバイスを頂けないでしょうか?

ちなみにGoogle play servicesを消して以前の状態にsyncしなおすと一番上のエラーに立ち戻ります。

使用エミュレーターデバイス - Nexus 5(API 21)

FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'. > 1 exception was raised by workers: java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class com.google.android.gms.measurement.AppMeasurement found in modules classes.jar(com.google.android.gms:play-services-measurement-impl:17.0.0) and classes.jar (com.google.firebase:firebase-analytics-impl:12.0.1) Duplicate class com.google.android.gms.measurement.AppMeasurement$ConditionalUserProperty found in modules classes.jar (com.google.android.gms:play-services-measurement-impl:17.0.0) and classes.jar (com.google.firebase:firebase-analytics-impl:12.0.1) Duplicate class com.google.android.gms.measurement.AppMeasurement$Event found in modules classes.jar (com.google.android.gms:play-services-measurement-impl:17.0.0) and classes.jar (com.google.firebase:firebase-analytics-impl:12.0.1) Duplicate class com.google.android.gms.measurement.AppMeasurement$EventInterceptor found in modules classes.jar (com.google.android.gms:play-services-measurement-impl:17.0.0) and classes.jar (com.google.firebase:firebase-analytics-impl:12.0.1) Duplicate class com.google.android.gms.measurement.AppMeasurement$OnEventListener found in modules classes.jar (com.google.android.gms:play-services-measurement-impl:17.0.0) and classes.jar (com.google.firebase:firebase-analytics-impl:12.0.1) Duplicate class com.google.android.gms.measurement.AppMeasurement$Param found in modules classes.jar (com.google.android.gms:play-services-measurement-impl:17.0.0) and classes.jar (com.google.firebase:firebase-analytics-impl:12.0.1) Duplicate class com.google.android.gms.measurement.AppMeasurement$UserProperty found in modules classes.jar (com.google.android.gms:play-services-measurement-impl:17.0.0) and classes.jar (com.google.firebase:firebase-analytics-impl:12.0.1) Duplicate class com.google.firebase.analytics.FirebaseAnalytics found in modules classes.jar (com.google.android.gms:play-services-measurement-api:17.0.0) and classes.jar (com.google.firebase:firebase-analytics-impl:12.0.1) Duplicate class com.google.firebase.analytics.FirebaseAnalytics$Event found in modules classes.jar (com.google.android.gms:play-services-measurement-api:17.0.0) and classes.jar (com.google.firebase:firebase-analytics-impl:12.0.1) Duplicate class com.google.firebase.analytics.FirebaseAnalytics$Param found in modules classes.jar (com.google.android.gms:play-services-measurement-api:17.0.0) and classes.jar (com.google.firebase:firebase-analytics-impl:12.0.1) Duplicate class com.google.firebase.analytics.FirebaseAnalytics$UserProperty found in modules classes.jar (com.google.android.gms:play-services-measurement-api:17.0.0) and classes.jar (com.google.firebase:firebase-analytics-impl:12.0.1) Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings

buildGrdle(Module: app)

android { compileSdkVersion 29 buildToolsVersion '29.0.0' defaultConfig { applicationId "" minSdkVersion 21 targetSdkVersion 29 versionCode 9 versionName "1.0.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility java_version targetCompatibility java_version } } dependencies { implementation 'com.google.android.gms:play-services:12.0.1' implementation 'com.google.firebase:firebase-core:17.0.1' implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.appcompat:appcompat:1.1.0-rc01' implementation 'androidx.core:core-ktx:1.2.0-alpha02' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1' testImplementation 'junit:junit:4.13-beta-3' androidTestImplementation 'androidx.test:runner:1.3.0-alpha02' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02' } apply plugin: 'com.google.gms.google-services'

buildGrdle(Project:)

buildscript { ext.kotlin_version = '1.3.41' ext.java_version = JavaVersion.VERSION_1_8 repositories { google() jcenter() } dependencies { classpath 'com.google.gms:google-services:4.2.0' classpath 'com.android.tools.build:gradle:3.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // 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 }

manifest file

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package=""> <uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <application android:allowBackup="true" android:hardwareAccelerated="false" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:largeHeap="true" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".SecretViewController" android:screenOrientation="portrait"> </activity> <activity android:name=".HowToViewController" android:screenOrientation="portrait"> </activity> <activity android:name=".FinalViewController" android:screenOrientation="portrait"> </activity> <activity android:name=".TimerViewController" android:screenOrientation="portrait"> </activity> <activity android:name=".QuestionSystem" android:screenOrientation="portrait"> </activity> <activity android:name=".MainActivity" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <meta-data android:name="preloaded_fonts" android:resource="@array/preloaded_fonts" /> </application> </manifest>

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

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

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

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

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

guest

回答1

0

ベストアンサー

おそらく、Firebaseが依存しているGoogle Playサービスのバージョンと、プロジェクトで追加したGoogle Playサービスのバージョンとで衝突が起きています。

app/build.gradle内の、

gradle

1implementation 'com.google.android.gms:play-services:12.0.1'

という宣言は不要なはずなので削除して試してみてください。

投稿2019/07/29 11:07

kakajika

総合スコア3131

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

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

Kotaro22

2019/07/29 23:02

>kakajikaさん 回答ありがとうございます! 無事にエラー解決する事が出来ました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問