[Java] Add project in any folder with Gradle

less than 1 minute read

Introduction

Since it was an irregular folder structure in React Native Android project, I will show you how to handle it properly with Gradle. In the case of sub-folders and folders of the same hierarchy, you can implement with Multi project with Gradle.

Folder structure

myapp/
  android/ ★ root project
    build.gradle
    settings.gradle ★ edit this
    app/ ★App project
      build.gradle
library/
  android/ ★ library project
    build.gradle

Configuration

settings.gradle


include':app'
// add from here
include':library'
project(':library').projectDir = file('../../library/android')
// add up to here

Reference site