# Can I export a headless JUCE App and use it as a static lib on iOS and Android?

**URL:** <https://forum.juce.com/t/can-i-export-a-headless-juce-app-and-use-it-as-a-static-lib-on-ios-and-android/47248>\
**Category:** General JUCE discussion\
**Created:** [August 8, 2021, 4:55pm UTC](https://forum.juce.com/t/can-i-export-a-headless-juce-app-and-use-it-as-a-static-lib-on-ios-and-android/47248 "2021-08-08T16:55:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![autumnrockdev](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@autumnrockdev](https://forum.juce.com/u/autumnrockdev)\
**Post date:** [August 8, 2021, 4:55pm UTC](https://forum.juce.com/t/can-i-export-a-headless-juce-app-and-use-it-as-a-static-lib-on-ios-and-android/47248/1 "2021-08-08T16:55:28Z")

</div>

I am currently trying to combine a real-time audio engine written in JUCE with UIs entirely built using native iOS and Android widgets. (Hoping to get the best from both worlds. 🙂)

Is it possible to export a headless JUCE app as a static library and call it in a separate iOS/Android project?

Any hint or help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![adamwilson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/adamwilson/32/1387_2.png) [@adamwilson](https://forum.juce.com/u/adamwilson)\
**Post date:** [August 8, 2021, 6:01pm UTC](https://forum.juce.com/t/can-i-export-a-headless-juce-app-and-use-it-as-a-static-lib-on-ios-and-android/47248/2 "2021-08-08T18:01:13Z")

</div>

See [Juce wrapper for SwiftUI project](https://forum.juce.com/t/juce-wrapper-for-swiftui-project/46931)  
and [GitHub - adamski/audioengine-demo: An example of a multi-platform library using JUCE](https://github.com/adamski/audioengine-demo) - there seems to be an issue building it on the latest Xcode, I’ve not had time to figure that out yet.

---

<div class="post-metadata">

**Author:** ![autumnrockdev](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@autumnrockdev](https://forum.juce.com/u/autumnrockdev)\
**Post date:** [August 8, 2021, 6:36pm UTC](https://forum.juce.com/t/can-i-export-a-headless-juce-app-and-use-it-as-a-static-lib-on-ios-and-android/47248/3 "2021-08-08T18:36:16Z")

</div>

Hi Adam, thank you for the reply! I will look into it and let you know if I manage to fix the building issue. 👍

---

<div class="post-metadata">

**Author:** ![adamwilson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/adamwilson/32/1387_2.png) [@adamwilson](https://forum.juce.com/u/adamwilson)\
**Post date:** [August 9, 2021, 8:53am UTC](https://forum.juce.com/t/can-i-export-a-headless-juce-app-and-use-it-as-a-static-lib-on-ios-and-android/47248/4 "2021-08-09T08:53:30Z")

</div>

Great thanks - please submit a PR if you figure something out!

I will need to get it working soon as well for an app update, so I will be taking a look at it over the next few weeks but can’t promise when.

---

<div class="post-metadata">

**Author:** ![autumnrockdev](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@autumnrockdev](https://forum.juce.com/u/autumnrockdev)\
**Post date:** [August 18, 2021, 6:16am UTC](https://forum.juce.com/t/can-i-export-a-headless-juce-app-and-use-it-as-a-static-lib-on-ios-and-android/47248/5 "2021-08-18T06:16:38Z")

</div>

Update:

I haven’t been able to fix the build error, but I got the sample code working as a static lib (which is probably what you want to do anyway since Apple doesn’t allow dynamic libraries in production.)

Here is what I did.

1. Create a static lib project in Projucer
2. Structure the project just like what Adam did in his sample project.
3. Compile the lib using the Xcode project generated by Projucer.
4. Create another separate iOS project in Xcode.
5. Reference the static lib in the new iOS project.

Here are the all build settings that you may need to change in the new Xcode project in order for this to work:

- Header search path. This needs to point to the header of your static lib
- Objective-C Bridging Header path. This needs to point to the bridging file in your new Xcode project.
- Library Search Path. This needs to point to the static lib.
- Other linker flags. You might also need to include “-lstdc++” in the other linker flags.
- Add your own static lib and any iOS framework used by JUCE (AudioToolBox, CoreMIDI, AVFoundation…) to “Link Binary With Libraries” under your project’s “Build Phases” window.

---

<div class="post-metadata">

**Author:** ![adamwilson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/adamwilson/32/1387_2.png) [@adamwilson](https://forum.juce.com/u/adamwilson)\
**Post date:** [August 18, 2021, 6:24pm UTC](https://forum.juce.com/t/can-i-export-a-headless-juce-app-and-use-it-as-a-static-lib-on-ios-and-android/47248/6 "2021-08-18T18:24:13Z")

</div>

Thanks for writing this up!

I have generally been switching between static for iOS and dynamic for Android.  
This would be easier using CMake
