Gurupreet / ComposeCookBook

A Collection on all Jetpack compose UI elements, Layouts, Widgets and Demo screens to see it's potential
MIT License
6.3k stars 799 forks source link

cannot build the source file #112

Open changgyu-brandi opened 3 years ago

changgyu-brandi commented 3 years ago

When I download, open this project and run, I got this error. AGP : 7.0.0 Gradle : 7.0 gradle plugin : 1.5.21

I think this is a problem of dsl, but don't know what to do.

e: /Users/user/Desktop/ComposeCookBook-master/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (8, 1): Expression 'android' cannot be invoked as a function. The function 'invoke()' is not found e: /Users/user/Desktop/ComposeCookBook-master/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (8, 1): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: internal val ComPluginGroup.android: ComAndroidPluginGroup defined in gradle.kotlin.dsl.plugins._a477e4bb38b5f342e70f4eed110d6eb4 in file PluginSpecBuilders.kt internal val OrgJetbrainsKotlinPlatformPluginGroup.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._a477e4bb38b5f342e70f4eed110d6eb4 in file PluginSpecBuilders.kt internal val OrgJetbrainsKotlinPluginGroup.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._a477e4bb38b5f342e70f4eed110d6eb4 in file PluginSpecBuilders.kt internal val PluginDependenciesSpec.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._a477e4bb38b5f342e70f4eed110d6eb4 in file PluginSpecBuilders.kt

alifesoftware commented 3 years ago

Are you on ArcticFox? Are you using JDK 11?

Also, downgrade Gradle plugin to 1.5.10

Gurupreet commented 3 years ago

Hey sure let me look into it but current build was on Latest Canary Bumblebee.

rio258k commented 3 years ago

I'm also failing to build the the buildSrc module on master using JDK 11 and latest Bumblebee:

Android Studio Bumblebee | 2021.1.1 Canary 11 Build #AI-211.7628.21.2111.7676841, built on August 26, 2021 Runtime version: 11.0.11+0-b60-7590822 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 11.4

Gurupreet commented 3 years ago

Hey @rio258k please check if this issue helps you Issue. I just tried on Canary11 it seems to work.

charlee-dev commented 3 years ago

If you try to open it in Android Studio stable it gives you hundreds of errors. you need to open it in latest Android Studio Canary

ankursingh15 commented 3 years ago

I am getting errors while building as well Config used 1-Artic Fox+Java 11 and Kotlin Gradle plugin 1.5.21 and 1.5.10 and Build Gradle 7.1.0-alpha12 and 7.0.2 2-Bumble Bee +Java 11 and Kotlin Gradle plugin 1.5.21 and 1.5.10 and Build Gradle 7.1.0-alpha12 and 7.0.2

e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (8, 1): Expression 'android' cannot be invoked as a function. The function 'invoke()' is not found e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (8, 1): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: internal val ComPluginGroup.android: ComAndroidPluginGroup defined in gradle.kotlin.dsl.plugins._d1e091191c097fb6c445db89abf89fb8 in file PluginSpecBuilders.kt internal val OrgJetbrainsKotlinPlatformPluginGroup.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._d1e091191c097fb6c445db89abf89fb8 in file PluginSpecBuilders.kt internal val OrgJetbrainsKotlinPluginGroup.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._d1e091191c097fb6c445db89abf89fb8 in file PluginSpecBuilders.kt internal val PluginDependenciesSpec.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._d1e091191c097fb6c445db89abf89fb8 in file PluginSpecBuilders.kt e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (9, 5): Unresolved reference: compileSdk e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (11, 5): Unresolved reference: defaultConfig e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (12, 9): Unresolved reference: minSdk e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (13, 9): Unresolved reference: targetSdk e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (16, 5): Unresolved reference: compileOptions e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (17, 9): Unresolved reference: sourceCompatibility e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (18, 9): Unresolved reference: targetCompatibility e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (20, 5): Unresolved reference: kotlinOptions e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (21, 9): Unresolved reference: jvmTarget e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (22, 9): Unresolved reference: freeCompilerArgs e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (22, 28): Unresolved reference: freeCompilerArgs e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (24, 5): Unresolved reference: buildFeatures e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (25, 9): Unresolved reference: compose e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (27, 5): Unresolved reference: composeOptions e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-compose-module-configs-script-plugin.gradle.kts: (28, 9): Unresolved reference: kotlinCompilerExtensionVersion e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-kotlin-module-configs-script-plugin.gradle.kts: (9, 1): Expression 'android' cannot be invoked as a function. The function 'invoke()' is not found e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-kotlin-module-configs-script-plugin.gradle.kts: (9, 1): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: internal val ComPluginGroup.android: ComAndroidPluginGroup defined in gradle.kotlin.dsl.plugins._d1e091191c097fb6c445db89abf89fb8 in file PluginSpecBuilders.kt internal val OrgJetbrainsKotlinPlatformPluginGroup.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._d1e091191c097fb6c445db89abf89fb8 in file PluginSpecBuilders.kt internal val OrgJetbrainsKotlinPluginGroup.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._d1e091191c097fb6c445db89abf89fb8 in file PluginSpecBuilders.kt internal val PluginDependenciesSpec.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._d1e091191c097fb6c445db89abf89fb8 in file PluginSpecBuilders.kt e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-kotlin-module-configs-script-plugin.gradle.kts: (10, 5): Unresolved reference: compileSdk e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-kotlin-module-configs-script-plugin.gradle.kts: (12, 5): Unresolved reference: defaultConfig e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-kotlin-module-configs-script-plugin.gradle.kts: (13, 9): Unresolved reference: minSdk e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-kotlin-module-configs-script-plugin.gradle.kts: (14, 9): Unresolved reference: targetSdk e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-kotlin-module-configs-script-plugin.gradle.kts: (17, 5): Unresolved reference: compileOptions e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-kotlin-module-configs-script-plugin.gradle.kts: (18, 9): Unresolved reference: sourceCompatibility e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-kotlin-module-configs-script-plugin.gradle.kts: (19, 9): Unresolved reference: targetCompatibility e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-kotlin-module-configs-script-plugin.gradle.kts: (21, 5): Unresolved reference: kotlinOptions e: /Users/asingh/AndroidStudioProjects/ComposeCookBook/buildSrc/src/main/kotlin/common-kotlin-module-configs-script-plugin.gradle.kts: (22, 9): Unresolved reference: jvmTarget

FAILURE: Build failed with an exception.

Gurupreet commented 3 years ago

Thanks let me try to add fix for stable AS version. Project should be working on Latest canary version. Please fetch latest changes.

joelc1225 commented 2 years ago

Same error on latest Chipmunk Canary

Android Studio Chipmunk | 2021.2.1 Canary 5 Build #AI-212.5457.46.2112.7905983, built on November 11, 2021 Runtime version: 11.0.12+0-b1504.28-7817840 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 11.6 GC: G1 Young Generation, G1 Old Generation Memory: 1280M Cores: 16 Registry: external.system.auto.import.disabled=true****

minminaya commented 2 years ago

AS-version:Android Studio Bumblebee 2021.1.1 Beta4

change sourceCompatibility and targetCompatibility to JavaVersion.VERSION_11 and change jvmTarget to "11" has fix this issue

compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = "11"
        freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
    }