Skip to content

[Flutter 3.29] UnityLibrary Build Fails in New Flutter Projects Using Gradle Kotlin DSL (build.gradle.kts) #1002

Closed
@suryanadiminti99

Description

@suryanadiminti99

Description:
In newly created Flutter projects, Flutter now generates only build.gradle.kts (Gradle Kotlin DSL) files instead of traditional build.gradle (Groovy). When trying to build unityLibrary, the build fails because it does not recognize build.gradle.

I'm facing a compilation issue when using flutter_unity_widget in my Flutter project, which uses Gradle Kotlin DSL (build.gradle.kts). The error occurs when running ./gradlew assembleDebug or flutter build.

Error Log
Execution failed for task ':flutter_unity_widget:compileReleaseKotlin'.

A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
Compilation error. See log for more details

Kotlin Version
kotlin -version
Kotlin version 2.1.10-release-473 (JRE 17.0.14+0)

Steps to Reproduce:
Create a Flutter project with Gradle Kotlin DSL (build.gradle.kts).
Add flutter_unity_widget as a dependency.
Run flutter pub get.
Attempt to build the project with flutter build apk or ./gradlew assembleDebug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions