In Eclipse I can add a source folder to my android project as a "linked source folder". How do I achieve the same thing in Android Studio?
Or is it possible to add a external folder to build in gradle?
In the drop down menu click on the new option. After this a drop down menu opens here you will see directory option just click on that. After this enter the name of your directory / folder and press enter this will create a new folder / directory inside your root folder.
The res/values folder is used to store the values for the resources that are used in many Android projects to include features of color, styles, dimensions etc.
in your build.gradle add the following to the end of the android node
android { .... .... sourceSets { main.java.srcDirs += 'src/main/<YOUR DIRECTORY>' } }
The right answer is:
android { .... .... sourceSets { main.java.srcDirs += 'src/main/<YOUR DIRECTORY>' } }
Furthermore, if your external source directory is not under src/main
, you could use a relative path like this:
sourceSets { main.java.srcDirs += 'src/main/../../../<YOUR DIRECTORY>' }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With