# Import some dependencies for Android

**URL:** <https://forums.fusetools.com/t/import-some-dependencies-for-android/3120>\
**Category:** How-to Discussions\
**Created:** [May 5, 2017, 1:20am UTC](https://forums.fusetools.com/t/import-some-dependencies-for-android/3120 "2017-05-05T01:20:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![clifflo.the.diskjock](https://avatars.discourse-cdn.com/v4/letter/c/46a35a/32.png) [@clifflo.the.diskjock](https://forums.fusetools.com/u/clifflo.the.diskjock)\
**Post date:** [May 5, 2017, 1:20am UTC](https://forums.fusetools.com/t/import-some-dependencies-for-android/3120/1 "2017-05-05T01:20:18Z")

</div>

With regard to foreign code, I would like to ask a question. Of course we would have to use foreign code to link between Fuse and the native platform. However my plan is that I would write up a native library for its own and then let foreign code import the relevant modules. As per my knowledge I know that in the build settings I may have some tweaks for it, but it does now show whether I can perhaps make a plain old Android project firstly and change the build settings like Gradle directly. Therefore I am not sure whether I could write codes within a plain old Android project and then link via foreign code. I am wondering if I would need to build a library in another project and then package it as a library and let Fuse to use Gradle to download that module.

---

<div class="post-metadata">

**Author:** ![Baggers](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/baggers/32/665_2.png) [@Baggers](https://forums.fusetools.com/u/Baggers)\
**Post date:** [May 5, 2017, 8:08am UTC](https://forums.fusetools.com/t/import-some-dependencies-for-android/3120/2 "2017-05-05T08:08:43Z")

</div>

`my plan is that I would write up a native library for its own and then let foreign code import the relevant modules.`

Sounds ideal!

`in the build settings I may have some tweaks for it`

It depends what kind of tweaks. You can easy add entries to the dependencies & repositories in the ‘top level’ `build.gradle` file & also depenencies to the ‘app module’ `build.gradle` file.

We also automatically tell gradle to include any `jar` in the `app/src/main/libs` folder. So Then we only need to copy the jar into the folder on build (and that is easy to do with UXL)

In summary your project seems very possible but feel free to explain the details of the build details and I’ll have a look to see if there is anything that may cause issues.

---

<div class="post-metadata">

**Author:** ![clifflo.the.diskjock](https://avatars.discourse-cdn.com/v4/letter/c/46a35a/32.png) [@clifflo.the.diskjock](https://forums.fusetools.com/u/clifflo.the.diskjock)\
**Post date:** [May 5, 2017, 1:23pm UTC](https://forums.fusetools.com/t/import-some-dependencies-for-android/3120/3 "2017-05-05T13:23:14Z")

</div>

Hi Chris just now you said that Fuse would “automatically tell gradle to include” include `jar` in the `app/src/main/libs`, so do you mean that this is a default configuration or do we have to do something with UXL?

---

<div class="post-metadata">

**Author:** ![Baggers](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/baggers/32/665_2.png) [@Baggers](https://forums.fusetools.com/u/Baggers)\
**Post date:** [May 9, 2017, 9:51am UTC](https://forums.fusetools.com/t/import-some-dependencies-for-android/3120/4 "2017-05-09T09:51:50Z")

</div>

Sorry I wasn’t very clear. When you build fuse makes an android project under the `build/Android/Debug/` folder. Android projects can have a libs folder in `app/src/main`. So the fullpath would be `<YourAppName>/build/Android/Debug/app/src/main/libs`. if you put a `jar` in there it will be included in the build.

Now doing that by hand every build would suck so we wan to use some `UXL` to copy that file from your project directory into that `lib/` directory for us.

Make a file called `whatever.uxl` in your project and inside add the following:

```auto
<Extensions Backend="CPlusPlus" Condition="Android">
	<CopyFile Condition="Android" Name="yourLovelyLib.jar" TargetName="app/src/main/libs/google-yourLovelyLib.jar" />
</Extensions>

```

And then this your jar will be copied into the `libs` folder during the build, which will add it to the build itself[0].

Hope this helps!

[0] If you are curious to how this is done in gradle you can browse to `<YourAppName>/build/Android/Debug/app/build.gradle` and check you should see the `compile fileTree(dir: 'src/main/libs', include: ['*.jar'])` line in the `dependencies` section at the top 🙂
