0

私はdataモジュールがライブラリであり、presentationレイヤが実際のアンドロイドアプリであるアプリケーションを設定しようとしています。理想的には、firebaseの依存関係はdataモジュールにしか存在しませんが、apply plugin: 'com.google.gms.google-services'presentationモジュールからのみ呼び出すことができます。一緒に短剣2とfirebase依存を置くデータモジュールのAndroid Kotlin Dagger 2とFirebase Authの使い方は?

は私に次のエラーを与える:firebase認証依存や短剣2依存関係を削除

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':presentation:transformDexArchiveWithExternalLibsDexMergerForDebug'. 
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex 

は、この問題を解決します。 dataモジュールでこれらのライブラリを一緒に使用するにはどうすればよいですか?

プレゼンテーション用data

apply plugin: 'com.android.library' 

apply plugin: 'kotlin-android' 

apply plugin: 'kotlin-android-extensions' 

apply plugin: 'kotlin-kapt' 


android { 
    compileSdkVersion 26 
    buildToolsVersion '26.0.2' 


    defaultConfig { 
     minSdkVersion 19 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 

     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 

    } 

    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' 
    testImplementation 'junit:junit:4.12' 
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" 

    compile "android.arch.lifecycle:extensions:1.0.0-alpha9-1" 

    compile 'com.google.dagger:dagger:2.11' 
    kapt 'com.google.dagger:dagger-compiler:2.11' 

    compile 'com.google.firebase:firebase-auth:11.4.2' 
} 

そしてbuild.gradleのための私のbuild.gradle:(必要な場合)ここで

apply plugin: 'com.android.application' 

    apply plugin: 'kotlin-android' 


    android { 

     def configs = rootProject.extensions.getByName("ext") 

     compileSdkVersion configs["compileSdkVersion"] 
     buildToolsVersion configs["buildToolsVersion"] 
     defaultConfig { 
      applicationId configs["androidApplicationId"] 
      minSdkVersion configs["minSdkVersion"] 
      targetSdkVersion configs["targetSdkVersion"] 
      versionCode configs["versionCode"] 
      versionName configs["versionName"] 
      testInstrumentationRunner configs["testInstrumentationRunner"] 
     } 
     buildTypes { 
      release { 
       minifyEnabled false 
       proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
      } 
     } 
     buildToolsVersion '26.0.2' 
    } 

    dependencies { 
     implementation fileTree(include: ['*.jar'], dir: 'libs') 
     implementation project(':data') 
     implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion" 
     implementation 'com.android.support.constraint:constraint-layout:1.0.2' 
     testImplementation "junit:junit:$rootProject.junitVersion" 
     androidTestImplementation("com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion", { 
      exclude group: 'com.android.support', module: 'support-annotations' 
     }) 
     implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" 

    } 

    apply plugin: 'com.google.gms.google-services' 

は、トップレベルのビルドファイルである

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    ext.kotlin_version = '1.1.4-3' 
    repositories { 
     google() 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.0-beta7' 
     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 
     classpath 'com.google.gms:google-services:3.1.0' 
    } 
} 

allprojects { 
    repositories { 
     google() 
     jcenter() 
    } 
    ext { 
     //Android 
     androidApplicationId = 'com.test.myapp' 
     minSdkVersion = 19 
     targetSdkVersion = 26 
     versionCode = 1 
     versionName = "1.0" 
     compileSdkVersion = 26 
     buildToolsVersion = "26.0.2" 

     //Libraries 
     supportLibraryVersion = '26.1.0' 

     //Testing 
     testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" 
     junitVersion = "4.12" 
     espressoVersion = "3.0.1" 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

答えて

0

問題はGoogleサービスのバージョンのようだったようです。 3.1.0

から

classpath 'com.google.gms:google-services:3.1.1' 

:私はプレイサービスのバージョンを更新した後に問題が私のために解決します

関連する問題