skip to Main Content

Why is my build.gradle looking like this?

and not like this:

I was trying to connect Chaquopy with Android Studio.

2

Answers


  1. You use a version catalog with your gradle setup. To learn more about what that is and how to migrate your old gradle files: https://developer.android.com/build/migrate-to-catalogs

    Version catalogs are the recommended way of defining gradle dependencies now.

    Login or Signup to reply.
  2. Gradle has multiple ways of doing the same thing, and with new versions come new ways of doing something, and often the new ways are recommended over the old ways. This, unfortunately, can get very confusing.

    Your first image shows a Gradle file which uses a multi-project build and a version catalog.

    The file is in the top-level directory, and the apply false tells it not to apply these plugins to the top level, but to make them available to sub-projects. Your screenshot shows that you have a sub-project in the app directory.

    The version catalog is kept in the file gradle/libs.versions.toml and all projects can then refer to the same version of each library. When adding a new dependency, you should add it to the version catalog first, and then reference it in your project. The file already has a few dependencies during creation time, which will guide you to the correct syntax to use.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search