Skip to content

Conversation

@timbotimbo
Copy link
Collaborator

Since Flutter 3.29, new projects will use the Kotin gradle DSL.
Files like build.gradle and settings.gradle now have a .gradle.kts extension.

Besides the file extension change, the syntax is different.

For example:

- implementation project(':unityLibrary')
+ implementation(project(":unityLibrary"))
flatDir {
-    dirs "${project(':unityLibrary').projectDir}/libs"
+    dirs(file("${project(":unityLibrary").projectDir}/libs"))
}

This PR adds this new syntax as alternative code blocks in the README.

To reproduce and test this:

  • delete android folder of the example.
  • Regenerate it with Flutter 3.29 by running
flutter create --org=com.learntoflutter. --project-name=flutter_embed_unity_example
  • Follow the new readme for .gradle.kts files
  • export unity
  • build the flutter example
  • Follow any flutter build error instructions. In my case:
    • set minsdk to 22 in app/build.gradle
    • remove ndkPath from unitylibary/build.gradle
    • set ndkVersion to "27.0.12077973" in app/build.gradle
  • example now runs with Flutter 3.29 gradle setup.

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

Successfully merging this pull request may close these issues.

2 participants