Невозможно разрешить зависимость для ': app @ debug / compileClasspath': не удалось разрешить проект: modulea - PullRequest
0 голосов
/ 02 ноября 2018

Я бы хотел разделить свое приложение на несколько модулей. Я делаю: Файл-> Новый модуль-> Модуль телефона и планшета . Затем я добавляю это в build.gradle (приложение) :

implementation project(path: ':modulea')

И когда я собираю приложение, я получаю следующее:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :modulea.
Open File
Show Details


Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :modulea.
Open File
Show Details


Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve project :modulea.
Open File
Show Details


Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve project :modulea.
Open File
Show Details


Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve project :modulea.
Open File
Show Details

Что я могу сделать для решения этой проблемы? Мой полный build.gradle (приложение) :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.evgen.myapplication"
        minSdkVersion 16
        targetSdkVersion 28
        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:28.0.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'
    implementation project(path: ':modulea')
}

И Мой build.gradle для модуля:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28



    defaultConfig {
        applicationId "com.example.modulea"
        minSdkVersion 16
        targetSdkVersion 28
        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:28.0.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'
}

И если я заменю это в модуле: применить плагин: 'com.android.application'

На

apply plugin: 'com.android.library'

Все работает. Но я бы хотел создать в модуле активность и другое представление компонентов. И это хорошая практика для разделения модулей таким образом?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...