1

I am getting this error after adding

buildFeatures {
        // Enables Jetpack Compose for this module
        compose true
    }

in buid.gradle file.

Error : A problem occurred evaluating project ':app'.

Could not find method buildFeatures() for arguments [build_54unkt2ry74bgjccfbal5enyq$_run_closure1$_closure10@24191eaa] on object of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.

Vinit Yadav
  • 284
  • 4
  • 14
  • 2
    You can add this only in Android Studio 4.0+ which is only available Canary build – aleem md Feb 26 '20 at 06:23
  • Does this answer your question? [Error when adding buildFeatures in build.gradle file](https://stackoverflow.com/questions/58692811/error-when-adding-buildfeatures-in-build-gradle-file) – Mangaldeep Pannu Feb 26 '20 at 07:21

1 Answers1

0

In App Gradle file

buildFeatures {
    // Enables Jetpack Compose for this module
    compose true
}

Make sure you are using

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

Add under dependencies in app "gradle file"

implementation 'androidx.ui:ui-tooling:0.1.0-dev02'
implementation 'androidx.ui:ui-layout:0.1.0-dev02'
implementation 'androidx.ui:ui-material:0.1.0-dev02'

Courtesy Developer Android

After setup, you can successfully use this. Thanks

Mangaldeep Pannu
  • 3,738
  • 2
  • 26
  • 45
Haseeb Mirza
  • 432
  • 2
  • 7