# Build a native lib for each project

**URL:** <https://discuss.gradle.org/t/build-a-native-lib-for-each-project/26738>\
**Category:** Help/Discuss\
**Created:** [April 26, 2018, 9:25am UTC](https://discuss.gradle.org/t/build-a-native-lib-for-each-project/26738 "2018-04-26T09:25:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vang](https://avatars.discourse-cdn.com/v4/letter/v/ecae2f/32.png) [@vang](https://discuss.gradle.org/u/vang)\
**Post date:** [April 26, 2018, 9:25am UTC](https://discuss.gradle.org/t/build-a-native-lib-for-each-project/26738/1 "2018-04-26T09:25:30Z")

</div>

I have the following android project layout.

> | root-project  
> |\_\_\_App1  
> |\_\_\_App2  
> |\_\_\_NativeLib

Each time i am building the project i want to rebuild the native lib for App1 and App2. This is necessary because each app configures the library with different settings.  
Using the library as a dependency in App1 and App2 doesn’t work as desired because externalNativeBuild is called only once.  
An approach would be to generate a GradleBuild task for App1 and another task for App2. Each task will perform a nested build, building the library with a different configuration each time.  
Is there a more elegant solution?
