Adding Realm android to flutter project not working

1,982

In my case, it was silly reason causing this issue. Instead of importing flutter project root folder in Android studio, import only android (flutter_project_root_dir/android) specific folder into Android Studio. This fixed the issue for me.

Hope this saves some time of others facing similar issue.

Share:
1,982
Ganapat
Author by

Ganapat

Updated on December 04, 2022

Comments

  • Ganapat
    Ganapat over 1 year

    I am trying to add Realm-android to my flutter project. I have added gradle dependencies as per the Realm documentation, but I still don't see realm packages in my android code, when I try to extend classes with Realm classes. I also tried gradle sync, gradlew clean assemble, but still no fix.

    Gradle files: /android/build.gradle

       repositories {
            ...
            jcenter()
            ...
        }
        dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.1.0'
        classpath 'io.realm:realm-gradle-plugin:5.0.0'
    }
    

    /android/app/build.gradle

    apply plugin: 'com.android.application'
    apply plugin: 'realm-android'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
    

    Thanks in advance.