Android Studio 3.0 introduced com.android.feature plugin. Because Realm explicitly checks for the existence of com.android.application or com.android.library plugins, applying realm-android in a feature causes an exception.
See the following line at Realm.groovy:
void apply(Project project) {
// Make sure the project is either an Android application or library
def isAndroidApp = project.plugins.withType(AppPlugin)
def isAndroidLib = project.plugins.withType(LibraryPlugin)
if (!isAndroidApp && !isAndroidLib) {
throw new GradleException("'com.android.application' or 'com.android.library' plugin required.")
}
And we need to verify how does the NDK work with instant app~
And how to fit in the 4 MB APK size limit
No luck with this one yet, huh? Apparently people are looking for it, see https://stackoverflow.com/questions/45995593/kotlin-use-realm-module-in-android?noredirect=1#comment78974747_45995593
Also according to this answer https://stackoverflow.com/questions/45878257/instant-app-and-splits-abi Instant Apps do not support ABI splits yet, which would also be a requirement to get below the 4MB limit.
ABI splits are now supported: https://android-developers.googleblog.com/2017/10/introducing-android-instant-apps-sdk-11.html?m=1. We're happy to offer any support in using the feature.
Beep boop any luck?
Has this been resolved, or at least being worked on? Wondering if I should just give up trying to integrate into my new instant app.
7 months later... any news about this issue?
the only way is with App Bundle, but i don't think that is compatible with Instant Apps?
Good news guys, it's deprecated: https://android-developers.googleblog.com/2019/04/google-play-instant-feature-plugin.html
Closing since Instant Apps have been deprecated in favor of App Bundle
Most helpful comment
ABI splits are now supported: https://android-developers.googleblog.com/2017/10/introducing-android-instant-apps-sdk-11.html?m=1. We're happy to offer any support in using the feature.