kotlin: Execution failed for task ':app:checkDebugDuplicateClasses'.
解決済
回答 1
投稿
- 評価
- クリップ 0
- VIEW 2,335
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>
-
気になる質問をクリップする
クリップした質問は、後からいつでもマイページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
クリップを取り消します
-
良い質問の評価を上げる
以下のような質問は評価を上げましょう
- 質問内容が明確
- 自分も答えを知りたい
- 質問者以外のユーザにも役立つ
評価が高い質問は、TOPページの「注目」タブのフィードに表示されやすくなります。
質問の評価を上げたことを取り消します
-
評価を下げられる数の上限に達しました
評価を下げることができません
- 1日5回まで評価を下げられます
- 1日に1ユーザに対して2回まで評価を下げられます
質問の評価を下げる
teratailでは下記のような質問を「具体的に困っていることがない質問」、「サイトポリシーに違反する質問」と定義し、推奨していません。
- プログラミングに関係のない質問
- やってほしいことだけを記載した丸投げの質問
- 問題・課題が含まれていない質問
- 意図的に内容が抹消された質問
- 過去に投稿した質問と同じ内容の質問
- 広告と受け取られるような投稿
評価が下がると、TOPページの「アクティブ」「注目」タブのフィードに表示されにくくなります。
質問の評価を下げたことを取り消します
この機能は開放されていません
評価を下げる条件を満たしてません
質問の評価を下げる機能の利用条件
この機能を利用するためには、以下の事項を行う必要があります。
- 質問回答など一定の行動
-
メールアドレスの認証
メールアドレスの認証
-
質問評価に関するヘルプページの閲覧
質問評価に関するヘルプページの閲覧
checkベストアンサー
0
おそらく、Firebaseが依存しているGoogle Playサービスのバージョンと、プロジェクトで追加したGoogle Playサービスのバージョンとで衝突が起きています。
app/build.gradle内の、
implementation 'com.google.android.gms:play-services:12.0.1'
という宣言は不要なはずなので削除して試してみてください。
投稿
-
回答の評価を上げる
以下のような回答は評価を上げましょう
- 正しい回答
- わかりやすい回答
- ためになる回答
評価が高い回答ほどページの上位に表示されます。
-
回答の評価を下げる
下記のような回答は推奨されていません。
- 間違っている回答
- 質問の回答になっていない投稿
- スパムや攻撃的な表現を用いた投稿
評価を下げる際はその理由を明確に伝え、適切な回答に修正してもらいましょう。
15分調べてもわからないことは、teratailで質問しよう!
- ただいまの回答率 88.32%
- 質問をまとめることで、思考を整理して素早く解決
- テンプレート機能で、簡単に質問をまとめられる
2019/07/30 08:02
回答ありがとうございます! 無事にエラー解決する事が出来ました。