When I set the private attribute to False, the project builds, but then crashes at Runtime with java.lang.ClassNotFoundException: Didn't find class "okio.Buffer". The okio jar is referenced by another jar I’m including (Squareup’s okhttp3). What exactly does the private tag do?
Private is the internal name (MSBuild legacy) for Copy Local. For Android, it means that the .jar file will be included in the DEXed binary (opposed to being available somewhere else externally, at runtime). For Android, really all .jars except the main android.jar must be embedded.
IOW, it’s perfectly expected that if you don’t Copy Local the reference, that the class will be missing at runtime.
As for why it fails to DEX with the reference, I’ll ned to investigate. But your build log does not include the actual DEX error — in your log, the build failed omg the compile phase, with errors such as
E: Globals are disabled in the project settings [C:\Users\mattr\Code\Accordance\android\AccordanceAndroid\com.accordancebible.Accordance\TheCommonCode\p105SingleVerse.pas (4911)]
E: Modifier mismatch for parameter 2, expected "var" but found "in" [C:\Users\mattr\Code\Accordance\android\AccordanceAndroid\com.accordancebible.Accordance\UX\AdvancedSearchDialogFragment.pas (96)]
it seems that you will want to review your project options to make sure AllowGlobals is not set to false (it default to true now, so my guess is that your project has it explicitly set to false), and to explicitly set AllowLegacyOutParameters to true (it defaults to false).
I’ll download the .jar now and will see if I can repro the DEX error on my end, in a plain project…
I’m afraid I cannot reproduce this. created a new Android project form, template, added the downloaded .jar as reference, and ir builds and DEXes fine:
Oh wait, and I also see you’re using Version 9.3.103.2211. All bets are off with that, then, may well be a bug we fixed in the 14 months since that shipped
Note that I can’t be sure that that’s the difference, since husky its not the compile itself that fails, but DEX (which isn’t ours, its a tool from the Android tool chain). I suggets you try updating top the latest Android tools, if you haven’t yet. the version of DEX I used is sdk/build-tools/28.0.0-rc1/lib/dx.jar.
In essence, I can see three potential scenarios here:
it’s a bug in DEX that got fixed. If that’s the case, updating the Android tools may help
it’s a bug/difference in there compiler that we fixed (indirectly) between 9.3 and latest
it’s something more complex in the interaction between that jar and your code that makes DEX fail (in this case, it might still fail for you, even in v10, and we’d need to investigate further.
I suggest
updates the tools
try creating a new Apple add the jar, build. does that work, or does it fail too?
send me the DEX output from the failed build (be it the new app, or your actual project).