Android Studio - Inspect Code - Exclude generated files

前端 未结 4 1862
梦如初夏
梦如初夏 2021-02-20 03:24

Is there any way, how to exclude android generated files (or manually specify excluded folders), from Analyze -> Inspect Code ?

相关标签:
4条回答
  • 2021-02-20 04:06

    I've found answer

    Excluded folders won't be taken in account for Code Analysis

    • Right-click on top-level element and go to Open Module Settings
    • There you have listed single modules, select correct module
    • In right column select folders to be excluded and either right click -> exclude or button exclude above the file tree
    • In left column remove all leftover references to excluded directories from other groups than Excluded Folders

    Excluding folders

    0 讨论(0)
  • 2021-02-20 04:08

    You can do it using the Gradle IDEA plugin:

    apply plugin: 'idea'
    idea {
        module {
            excludeDirs = [file("unwanted-directory-name")]
        }
    }
    
    0 讨论(0)
  • 2021-02-20 04:08

    Take a look at this answer:

    You basically just create a custom scope with the following pattern: !file:*intermediates*/&&!file:*generated*/&&!lib:*..*

    Hope this helps.

    0 讨论(0)
  • 2021-02-20 04:22

    Use a custom scope. After clicking Analyze > Inspect Code, from the Specify Inspection Scope dialog, click "..." after "Custom scope". Define a new scope. Recursively include Android, app, and whatever else is important. Then recursively exclude folders you don't want.

    I like to put my generated code in the build folder and exclude it. (To get code in the build folder to be included in the build, include it in app.gradle in android/sourceSets/main/java.srcDirs.)

    0 讨论(0)
提交回复
热议问题