mikepenz/Android-Iconics

Migrating from string resources to SPI

zTrap opened this issue · 16 comments

zTrap commented

What do you think about migrating to Java Service Provider Interface?

If we can make it work for android without any major overhead I would say absolutely.
One thing which is very relevant all the time though... obfuscation :D

zTrap commented

We can make this, but we need to switch to jar packaging for typeface libraries. And obfuscation work perfectly with SPI :)

Why would we need the jar packaging? the aar packaging is like a jar with additional features.
Maybe I miss something important here?

zTrap commented

Aar removes META-INF folder from package, but SPI requires it

hmmmm then there may be a different issue, as this may get lost in the end again via proguard. many people have a packaging rule to exclude meta inf files. due to conflicts of other libs.. :/

zTrap commented

Hmm, ok, I’ll investigate this

zTrap commented

My bad, it works perfectly with aar and auto-service (which adds all required information in META-INF automatically)

Hmm I would propose that we have a look on how this meta data has to look like and we add it manually then to not rely on external dependencies.
but that sounds like it could work

zTrap commented

I'we tried to add META-INF manually in res folder, but it wont work. Maybe I did something wrong... But I don't think this dependency is redundant. It's can be used in kapt configuration for processor and compileOnly for annotation, so nothing redundant is added to libraries

but it will have to be mentioned in the licenses. and as it is a compile time dependency only, there is no reference left in the dependency tree, so AboutLibraries won't see it :D

Oh the META-INF won't be in the res folder. as it is "special" compile time.

I think we may be able to write to it via gradle :)

zTrap commented

Sounds good :)

Theoretically we could just use the ContentProvider of android to auto register the font dependencies...
https://medium.com/@andretietz/auto-initialize-your-android-library-2349daf06920

I am not really sure about the real world performance impact of having many contentProviders in an app :/

so let's say there are 5 fonts in an app. what would be the impact?

zTrap commented

Idk, we need to test it

Well google just made this one a lot easier :D https://developer.android.com/topic/libraries/app-startup

zTrap commented

Look's so pretty and easy. We'll wait for stable version?

I'd say we prepare a beta release of Android-Iconics v6 :D and wait for it's release until the app startup library is at least in beta :)

I'm gonna spend a bit of time on this, this week to prepare things :)