1

Context

My library project has a documentation site which source is written in MarkDown and stored in ./docgen.


Problem

I am currently refactoring a lot of classes, making a good use of Android Studio's Rename feature. However, as the documentation files are not part of Android Studio's Project, refactoring updates the name of the classes in the code and in my comments, but not in those documentation files.


Investigation

  • I tried adding the folder as an Asset:

    sourceSets { main { assets.srcDirs = ['src/main/assets', 'docgen'] } }
    The folder is now displayed in Android Studio, but no .md file is visible and the Rename feature still misses those files.

  • I see on other questions that one can add assets to a project, packaging those files in the application or library. But I don't want to release them, I would just enjoy leveraging my IDE's rename feature across the whole project, not only in the library's code!

  • I see some questions asking how one can exclude some classes from the build. But in my case the files I don't want to exclude from the build are not considered part of the project by Android Studio!


Question

Is there a way to add a folder of markdown files to an Android Project's scope without packaging them in the release?

PLNech
  • 3,087
  • 1
  • 23
  • 52
  • Have you looked [at these questions](https://www.google.com/search?q=android+studio+exclude+files+from+build&oq=android+studio+exclude+files+&aqs=chrome.1.69i57j0l5.9435j0j7&sourceid=chrome&ie=UTF-8)? – Al Lelopath Jul 19 '17 at 13:40
  • 1
    @AlLelopath oh good point, I had not considered adding them as assets *and* explicitly removing them from the release! Thanks for the pointer :) – PLNech Jul 19 '17 at 13:44
  • 1
    Possible duplicate of [Android Studio Exclude Class from build?](https://stackoverflow.com/questions/16701256/android-studio-exclude-class-from-build) – Zoe Jul 19 '17 at 13:50
  • @LunarWatcher the question you linked might be a partial solution (they explain how to exclude project files from the build), but doesn't answer the first part of my question (how to see them in Android Studio in the first place). – PLNech Jul 19 '17 at 13:56
  • @AlLelopath: These questions tell me how to exclude some files, but not how I can have those included in my Project in the first place. – PLNech Jul 19 '17 at 14:12

1 Answers1

-1

Try to use following code in your build.gradle file for app.

sourceSets {
    debug {
      assets.srcDirs = ['src/main/assets', 'docgen']
    }   
}

And remove your line from sourseSets block

{ main { assets.srcDirs = ['src/main/assets', 'docgen'] } 
Vova
  • 956
  • 8
  • 22
  • This does not work either: like with `{ main { assets ...} }`, the files are not visible in the Project tab and don't show up in searches or renames. – PLNech Jul 19 '17 at 14:44