简体   繁体   中英

feature andoid module - not permite to use apply plugin: 'com.android.feature'

i am trying to create a feature in android, but i get the next error

Executing tasks: [:app:assembleDebug] in project C:\\Users\\wilso\\OneDrive\\Documents\\retrofit_system\\retrofit_system

Configure project :feature:webview WARNING: The com.android.feature plugin is deprecated and will be removed by the end of 2019. Please switch to using dynamic-features or libraries. For more information on converting your application to using Android App Bundles, please visit https://developer.android.com/topic/google-play-instant/feature-module-migration WARNING: The com.android.feature plugin is deprecated and will be removed by the end of 2019. Please switch to using dynamic-features or libraries. For more information on converting your application to using Android App Bundles, please visit https://developer.android.com/topic/google-play-instant/feature-module-migration

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ':feature:webview'.

    'kotlin-android' expects one of the Android Gradle plugins to be applied to the project: * android * com.android.application * android-library * com.android.library * com.android.test * com.android.feature * com.android.dynamic-feature * com.android.instantapp

  • 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

BUILD FAILED in 383ms

The gradle is the next

apply plugin: 'com.android.feature'
apply plugin: 'kotlin-android'

android {

    defaultConfig {
        consumerProguardFiles 'consumer-proguard-rules.pro'
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    lintOptions {
        disable 'RtlEnabled'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {

}

I searched any solution, but i can't get nothing,

If I use the next gradle, it is functioned

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.co.webview"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

but i don't want to create a application, because i want to create a feature

I done a test and it was functioned

if i use the next gradle, my app builds

apply plugin: 'com.android.feature'

android {

    defaultConfig {
        consumerProguardFiles 'consumer-proguard-rules.pro'
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    lintOptions {
        disable 'RtlEnabled'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {



}

but if i use the next gradle, it is not functioned

apply plugin: 'com.android.feature'
apply plugin: 'kotlin-android'

android {

    defaultConfig {
        consumerProguardFiles 'consumer-proguard-rules.pro'
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    lintOptions {
        disable 'RtlEnabled'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {




}

the difference between the first and the second is apply plugin: 'kotlin-android'

changed to

new plugin: com.android.dynamic-feature

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM