Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot build the source file #112

Open
changgyu-brandi opened this issue Aug 27, 2021 · 9 comments
Open

cannot build the source file #112

changgyu-brandi opened this issue Aug 27, 2021 · 9 comments
Assignees

Comments

@changgyu-brandi
Copy link

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
Copy link

alifesoftware commented Sep 4, 2021

Are you on ArcticFox?
Are you using JDK 11?

Also, downgrade Gradle plugin to 1.5.10

@Gurupreet
Copy link
Owner

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

@rio258k
Copy link

rio258k commented Sep 14, 2021

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
Copy link
Owner

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

@charlee-dev
Copy link
Contributor

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
Copy link

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.

  • What went wrong:
    Execution failed for task ':buildSrc:compileKotlin'.

@Gurupreet
Copy link
Owner

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

@Gurupreet Gurupreet self-assigned this Oct 10, 2021
@joelc1225
Copy link

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
Copy link

minminaya commented Dec 8, 2021

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"
    }

humblehacker added a commit to humblehacker/kotlin-composable-architecture that referenced this issue May 11, 2022
When updating to Android Studio Chimpmunk, after removing all build directories, the `android` section of `shared-android.gradle.kts` was unrecoginized.

I found and applied this fix:
Gurupreet/ComposeCookBook#112 (comment)

In the process of testing this, I discovered that AS was launching both Intel and M1 java processes. Turned out that the 1.8 java processes were Intel, so I switched all `kotlin.jvmTargets` to 11 to avoid this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants