I’m trying to compile my app with a lower minSdkVersion. (from 24 down to 19, to support an older device).
I got it to build eventually after android studio lost the plot with shedloads of unresolved symbols…
APK installs but app errors out and does not run. So I ran it thru the debugger…
It’s hitting a JUCE String assertion
"If you get an assertion here, then you're trying to create a string from 8-bit data
that contains values greater than 127. These can NOT be correctly converted to unicode
because there's no way for the String class to know what encoding was used to
create them. The source data could be UTF-8, ASCII or one of many local code-pages.
To get around this problem, you must be more explicit when you pass an ambiguous 8-bit
string to the String class - so for example if your source data is actually UTF-8,
you'd call String (CharPointer_UTF8 ("my utf8 string..")), and it would be able to
correctly convert the multi-byte characters to unicode. It's *highly* recommended that
you use UTF-8 with escape characters in your source code to represent extended characters,
because there's no other way to represent these strings in a way that isn't dependent on
the compiler, source code editor and platform.
Note that the Projucer has a handy string literal generator utility that will convert
any unicode string to a valid C++ string literal, creating ascii escape sequences that will
work in any compiler."
Fair enough, but the triggering call is not from my code. It’s from juce_android_JNIHelpers.cpp line 109…
String path (cls->getClassPath());
If I throw in a cheeky wee cast on that line…
String path ((CharPointer_UTF8)cls->getClassPath());
then the assertion is not hit until later on, same JNIHelpers file, line 158…
LocalRef<jstring> classNameAndPackage (javaString (String (classPath).replaceCharacter (L'/', L'.')));
Now I don’t feel that following the debugger and casting every string that throws is particularly clever! I don’t want to be messing about with JUCE code. Don’t even know if that cast is correct thing.
Any ideas? (Ideally I’d rather not be targeting sdk 19 / 4.4.1 but I don’t even know if that’s the issue. )