Why does Gradle build my module in Release mode when the app is in Debug

前端 未结 4 1068
醉话见心
醉话见心 2020-11-28 05:26

I\'m making a new Android project, with the standard \'app\' module, as well as a library project (let\'s call it \'custom_lib\'). In the app

4条回答
  •  广开言路
    2020-11-28 05:36

    In the "Build Variants" panel window on the left, you should see both of your modules, and next to them the current "active" variants. For instance

    app          debug
    custom_lib   debug
    

    When calling Build > Make Project we are building every modules in the project in their current variant.

    However, due to a current Gradle limitation (https://code.google.com/p/android/issues/detail?id=52962), building app in debug will require building the release variant of custom_lib, and so you end up building both.

    I would recommend to not use Make Project but instead use the option below that says Make Module app. This option will change from app to lib based on the current selection in the Project panel or based on the current editor, and will always do only what's needed to build the current module.

    (Looking into this, we noticed that there isn't a shortcut for it, so we're adding one).

提交回复
热议问题