New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any chance of breaking out the org.json classes from the android_util library? #1370
Comments
That's certainly possible, but can't be a high priority since our team is so small. We do accept patch contributions, though (just saying 😉 ). If you avoid using the -ObjC link flag, only object files in a static library that resolve dependencies in your app will be linked into it. Xcode used to include that flag in new projects, but it's not required and is only necessary to dynamically load classes that are not explicitly referenced by other classes. Because it can link in unused code, -ObjC can increase the app size unnecessarily; a hello-world j2objc app is 2Meg bigger when linked with -ObjC. Since JUnit tests are dynamically loaded, test apps should always be linked with -ObjC. That's not a size issue, though, since test apps should never be distributed. If you have an app class that needs to be dynamically loaded, an easy solution is to refer to it using .class in another Java source. Here's an example from sun.security.jca.Providers, that forces the IosSecurityProvider and CertPathProvider classes to be linked: @SuppressWarnings("unused")
private static final Class<?>[] unused = new Class[] {
IosSecurityProvider.class,
CertPathProvider.class,
}; |
…n jre_emul internal classes. This is the first half of moving the org.json package into its own library (#1370). PiperOrigin-RevId: 327495284
…n jre_emul internal classes. This is the first half of moving the org.json package into its own library (#1370). PiperOrigin-RevId: 327495284
…n jre_emul internal classes. This is the first half of moving the org.json package into its own library (#1370). PiperOrigin-RevId: 327495284
…n jre_emul internal classes. This is the first half of moving Android's version of org.json into its own library (#1370). PiperOrigin-RevId: 327495284
…n jre_emul internal classes. This is the first half of moving Android's version of org.json into its own library (#1370). PiperOrigin-RevId: 327495284
…n jre_emul internal classes. This is the first half of moving Android's version of org.json into its own library (#1370). PiperOrigin-RevId: 327495284
…n jre_emul internal classes. This is the first half of moving Android's version of org.json into its own library (#1370). PiperOrigin-RevId: 327495284
…n jre_emul internal classes. This is the first half of moving Android's version of org.json into its own library (#1370). PiperOrigin-RevId: 327495284
…n jre_emul internal classes. This is the first half of moving Android's version of org.json into its own library (#1370). PiperOrigin-RevId: 328389030
PiperOrigin-RevId: 328429545
PiperOrigin-RevId: 328429545
PiperOrigin-RevId: 328517465
org.json classes are now built to dist/lib/json.jar and lib/libjson.a. |
Hi @tomball, thank you so much for this change and for the extra information you provided in your response earlier. I've been meaning to come back to this issue and follow through on some of what you said but I've been a little swamped at work and not managed to find the time. Please accept my apologies. About the |
I was revisiting the linker flags in my project today after a long time and I noticed that I'm linking the
android_util
library but the only classes I'm interested in within theandroid_utill
library are theorg.json
classes. I was wondering whether it could be possible in future versions of J2ObjC for theorg.json
classes to be offered as a separate, lighterorg_json
library?The text was updated successfully, but these errors were encountered: