# ClassNotFoundException for JuceSharingContentProvider

**URL:** <https://forum.juce.com/t/classnotfoundexception-for-jucesharingcontentprovider/35038>\
**Category:** Android\
**Created:** [September 2, 2019, 10:12am UTC](https://forum.juce.com/t/classnotfoundexception-for-jucesharingcontentprovider/35038 "2019-09-02T10:12:55Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [January 29, 2020, 4:36pm UTC](https://forum.juce.com/t/classnotfoundexception-for-jucesharingcontentprovider/35038/21 "2020-01-29T16:36:52Z")

</div>

No, this is already done for the JUCE classes. The README in juce\_core is just a guide on how to re-build and debug them if needed.

---

<div class="post-metadata">

**Author:** ![timart](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/timart/32/1119_2.png) [@timart](https://forum.juce.com/u/timart)\
**Post date:** [January 29, 2020, 9:01pm UTC](https://forum.juce.com/t/classnotfoundexception-for-jucesharingcontentprovider/35038/22 "2020-01-29T21:01:09Z")

</div>

@ed95 Thank you so much for the help Ed, my app now runs successfully! It seems moving to the latest JUCE development branch and Projucer has fixed the error for me. Thank you again!

I did get a build warning for JUCE included below, but this may be a known warning.

If this is helpful for anyone who later views this thread, I’ve included the steps I took to get a JUCE static library working on Android:

## Building JUCE as a Static Library for Android

- Download latest JUCE source repository from GitHub and switch to develop branch.
- Build Projucer app in release build mode (following instructions in the JUCE `README.md`).
- Create a Static Library project type in the Projucer and set module path to link the the local JUCE repository on develop.
- Set an exporter for Android and configure various settings you may need (MIN\_SDK\_VERSION, TARGET\_SDK\_VERSION).
- Set the Projucer project to use C++17.
- Save the Projucer project.
- Click the exporter button in Projucer to open the project in Android Studio.
- Press the Sync Project with Gradle button in Android Studio.
- Build the project in Debug mode.
- Build the project in Release mode.

**In all builds I received the following warnings. In the past, I have received these warnings and I sometimes remove the mode bits parameter in the call to `open()` to get rid of these warnings. But in this case, I did not modify anything.**

```auto
In file included from /Users/timarterbury/Documents/SDKs/ovr_sdk_mobile_1.29.0-a3/3rdParty/juce/juce_static_lib/JuceLibraryCode/include_juce_core.cpp:9:
In file included from ../../../../../../../../juce/modules/juce_core/juce_core.cpp:189:
../../../../../../../../juce/modules/juce_core/native/juce_posix_SharedCode.h:418:68: warning: 'open' has superfluous mode bits; missing O_CREAT? [-Wuser-defined-warnings]
    auto f = open (file.getFullPathName().toUTF8(), O_RDONLY, 00644);
                                                                   ^
/Users/timarterbury/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/bits/fortify/fcntl.h:76:9: note: from 'diagnose_if' attribute on 'open':
        __clang_warning_if(!__open_modes_useful(flags) && modes,
        ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/timarterbury/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/sys/cdefs.h:135:54: note: expanded from macro '__clang_warning_if'
#define __clang_warning_if(cond, msg)__attribute__((diagnose_if(cond, msg, "warning")))
                                                     ^ ~~~~
In file included from /Users/timarterbury/Documents/SDKs/ovr_sdk_mobile_1.29.0-a3/3rdParty/juce/juce_static_lib/JuceLibraryCode/include_juce_core.cpp:9:
In file included from ../../../../../../../../juce/modules/juce_core/juce_core.cpp:189:
../../../../../../../../juce/modules/juce_core/native/juce_posix_SharedCode.h:455:70: warning: 'open' has superfluous mode bits; missing O_CREAT? [-Wuser-defined-warnings]
        auto f = open (file.getFullPathName().toUTF8(), O_RDWR, 00644);
                                                                     ^
/Users/timarterbury/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/bits/fortify/fcntl.h:76:9: note: from 'diagnose_if' attribute on 'open':
        __clang_warning_if(!__open_modes_useful(flags) && modes,
        ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/timarterbury/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/sys/cdefs.h:135:54: note: expanded from macro '__clang_warning_if'
#define __clang_warning_if(cond, msg)__attribute__((diagnose_if(cond, msg, "warning")))
                                                     ^ ~~~~
2 warnings generated.

```

- Regardless of these warnings, all builds succeeded for me.
- To find the static library files produced from the build, I went to a subdirectory in my `juce_static_lib` JUCE project folder: `Builds/Android/lib/build/intermediates/cmake/...` and traversed to the appropriate build configuration folder to find the `libjuce_static_lib.a` file. I would’ve expected to see these in `Builds/Android/lib/build/outputs/...` but I only see `.aar` files and logs, but this may be my own misunderstanding. The `.aar` files are quite tiny 2KB, while the static library `.a` files are around 100MB.

After this successful build I then linked my Android VR app to the following libraries:

- **JUCE Static Library** : `Builds/Android/lib/build/intermediates/cmake/$(JUCE_CMAKE_BUILD_VARIANT)/obj/$(TARGET_ARCH_ABI)/libjuce_static_lib.a`
- **Android CPU Features Static Library** : `Builds/Android/lib/.cxx/cmake/$(JUCE_CMAKE_BUILD_VARIANT)/$(TARGET_ARCH_ABI)/libcpufeatures.a`

---

<div class="post-metadata">

**Author:** ![timart](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/timart/32/1119_2.png) [@timart](https://forum.juce.com/u/timart)\
**Post date:** [January 29, 2020, 9:21pm UTC](https://forum.juce.com/t/classnotfoundexception-for-jucesharingcontentprovider/35038/23 "2020-01-29T21:21:02Z")

</div>

**Quick followup question:**  
If I used the Projucer to build a static library of JUCE, and I linked that library to an Android project which is not using JUCE to manage the full app functionality via the `JuceApp` Java class, do I manually need to call `Thread::initialiseJUCE()` (or the Java alternative) on app startup? Do I need to call this function if I plan to use any of the JUCE event system?

My app seemed to run fine without doing this, as it only uses some OSC message sending functionality. I was able to successfully send an OSC message on a Network.

Thanks again for the help.

---

<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:** [January 29, 2020, 10:26pm UTC](https://forum.juce.com/t/classnotfoundexception-for-jucesharingcontentprovider/35038/24 "2020-01-29T22:26:50Z")

</div>

Yes you would. You can use the handy `ScopedJuceInitialiser_GUI` class for RAII startup and shutdown of JUCE events etc in your main app class.

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [January 30, 2020, 11:10am UTC](https://forum.juce.com/t/classnotfoundexception-for-jucesharingcontentprovider/35038/25 "2020-01-30T11:10:11Z")

</div>

> [@adamski](#):
>
> ScopedJuceInitialiser\_GUI

This won’t call `Thread::initailiseJUCE()`, it just sets up the message loop. If you aren’t using the autogenerated `com.roli.juce.JuceApp` Java class then you’ll need to call `Thread::initialiseJUCE()` somewhere in your app in addition to using the scoped initialiser. [This post](https://forum.juce.com/t/breaking-changes-in-juce-s-low-level-android-code/30338) contains some useful information on what needs to be done.

---

<div class="post-metadata">

**Author:** ![timart](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/timart/32/1119_2.png) [@timart](https://forum.juce.com/u/timart)\
**Post date:** [January 30, 2020, 5:24pm UTC](https://forum.juce.com/t/classnotfoundexception-for-jucesharingcontentprovider/35038/26 "2020-01-30T17:24:33Z")

</div>

Must I call `Thread::initailiseJUCE()` even if I do not plan to use JUCE GUI or JUCE Event related functionality?

---

<div class="post-metadata">

**Author:** ![mrotschi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/mrotschi/32/4764_2.png) [@mrotschi](https://forum.juce.com/u/mrotschi)\
**Post date:** [March 11, 2020, 2:47pm UTC](https://forum.juce.com/t/classnotfoundexception-for-jucesharingcontentprovider/35038/27 "2020-03-11T14:47:57Z")

</div>

I have the same “Warning” issue since I have updated the ndk (I think it’s related)  
Any news on that subject ?

Regards  
Edit: It has been fixed on the develop branch ([#e65ac0b](http://https://github.com/WeAreROLI/JUCE/commit/e65ac0b2cda644c5778684caba9a9474b0aa7ac7))

[Previous page](https://forum.juce.com/t/classnotfoundexception-for-jucesharingcontentprovider/35038.md?page=1)
