ClassNotFoundException: JuceMidiPort

I'm getting a crash on what looks like a missing class since updating to the latest JUCE tip (JUCE 4). Previously this codebase was using the last version of JUCE 3.2. 

java.lang.ClassNotFoundException: Didn't find class "com.codegarden.nativenavigation.JuceActivity$JuceMidiPort" on path: DexPathList[[zip file "/data/app/com.yourcompany.nativenavigation-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.yourcompany.nativenavigation-1, /vendor/lib, /system/lib, /system/lib/ste_omxcomponents]]

I'll roll back to 3.2 for now... 

Did you re-save your project in the introjucer, to create an updated java activity file?

Hey Adamski, make sure that when you change the Android SDK version in the introjucer that you re-save the project properly: this will create a new in the Builds/Android and Builds/AndroidStudio folder. The java file will have a different contents depending on if you are building for SDK version 23! So make sure you are using the java file that the Introjucer generated.

OK I see where the confusion came about now - its due to the mix up of minimum and target SDK versions, I put in 23 for the minimum SDK level (see which actually sets the compile and target SDK versions in the file. 

Great to see all the MIDI support for the latest version of Android! However currently I wish to support as many devices as possible so I'll keep the minimum SDK version at 11 for now. 

This brings me to another request - that we can set the compile and target versions to 23, minimum SDK version to 11 and not have the new Midi stuff generated in the Activity. This way we can use the latest support library versions and also support older devices. 

HI Fabian, this does not seem to be the case at the moment... even if I have minimum SDK version set to 11 it still generates all the new midi stuff. 



OK - I finally got this working !

Here are the steps I took to get an Android app with minimum SDK of 11 compiled and running with SDK 23:

  • Manually remove all references and classes to do with Midi and Bluetooth from the generated Activity
  • Remove methods: getAndroidBluetoothManager and getAndroidMidiDeviceManager from juce_Android_JNIHelpers.h
  • Remove juce_audio_devices module if present (this tries to call JuceMidiPort from the Activity which we have now removed. This is only a temporary solution!)

It would be very helpful if there was an #ifdef that removed those offending methods for lower API levels.