2017-11-27 12 views
1

Androidスタジオ3.1のプレビューでdagger2がうまくいかない理由は誰にも分かりますか?dagger2をAndroidスタジオに追加する3.1プレビュー

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    buildToolsVersion '26.0.2' 
    defaultConfig { 
     applicationId "com.orbitlab.mowerapp" 
     minSdkVersion 23 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     multiDexEnabled true 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    implementation fileTree(dir: 'libs', include: ['*.jar']) 
    implementation 'com.android.support:appcompat-v7:26.1.0' 
    implementation 'com.android.support.constraint:constraint-layout:1.0.2' 
    implementation 'com.android.support:support-v4:26.1.0' 
    implementation 'com.google.firebase:firebase-messaging:11.4.2' 
    implementation 'com.google.firebase:firebase-database:11.4.2' 
    implementation 'com.google.firebase:firebase-auth:11.4.2' 
    implementation "com.google.firebase:firebase-firestore:11.4.2" 
    testImplementation 'junit:junit:4.12' 
    androidTestImplementation 'com.android.support.test:runner:1.0.1' 
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 
    implementation 'com.android.support:cardview-v7:26.1.0' 
    implementation 'de.hdodenhof:circleimageview:2.2.0' 
    implementation 'com.google.code.gson:gson:2.8.2' 
    implementation 'com.github.bumptech.glide:glide:4.3.1' 
    annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1' 
    implementation 'com.android.support:customtabs:26.1.0' 
    implementation 'com.google.android.gms:play-services-fitness:11.4.2' 
    implementation 'com.google.android.gms:play-services-auth:11.4.2' 
    implementation 'com.squareup.retrofit2:retrofit:2.2.0' 
    implementation 'com.squareup.retrofit2:converter-gson:2.2.0' 

    annotationProcessor 'com.google.dagger:dagger-compiler:2.10' 
    implementation 'com.google.dagger:dagger:2.10' 

} 

プラグインを適用する:「com.google.gms.google-サービスの

をこれが私のアプリのbuild.gradleファイルがどのように見えるかです。私はプロジェクトのbuild.gradleファイルに何も追加していません。

誰でも手助けできますか?

編集:

今Gradleの同期が、(まだこのプロジェクトにダガー使用haventは)私のデバイスに展開しようとしたとき、私はDEXエラーが発生します。 エラーは次のとおりです。

Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' 
+0

1.Clean

あなたが試してみました**実装**ではなく**コンパイル**? –

+0

@HarshadPrajapati変更なし:/ –

+0

あなたのアプリでGoogle Playサービスを使用していますか? –

答えて

0

は短剣のバージョンを更新し、このようにそれをチェックしてみてください。あなたは、ファイルをGradleのために、次のコードを追加する必要が

annotationProcessor 'com.google.dagger:dagger-compiler:2.10' 
implementation 'com.google.dagger:dagger:2.10' 
+0

変更なし、デックスマージエラーが発生する –

+0

以前のAndroidスタジオバージョンで正常に動作していますか? –

0

android { 
    defaultConfig { 
     multiDexEnabled true 
    } 
} 

次に、プロジェクト

2.Buildコード

+0

これに加えて.graldleフォルダも削除してみました。まだ同じエラー。 –

関連する問題