Install Android SDK

To configure Android for Flutter, follow these steps:

  1. Add GitHub Maven credentials to your project's build file.
    1. If your app uses android/build.gradle.kts (Kotlin), add the following block to the allprojects > repositories section:
      allprojects {
          repositories {
              // ... other repositories
              maven {
                  url = uri("https://maven.pkg.github.com/Capillary/hydra-sdk-android-maven")
                  credentials {
                      username = System.getenv("HYDRA_GITHUB_USER_NAME")
                      password = System.getenv("HYDRA_GITHUB_PAT")
                  }
              }
          }
      }
      
    2. If your app uses android/build.gradle (Groovy), add the following block to the allprojects > repositories section:
      allprojects {
          repositories {
              // ... other repositories
              maven {
                  url "https://maven.pkg.github.com/Capillary/hydra-sdk-android-maven"
                  credentials {
                      username System.getenv("HYDRA_GITHUB_USER_NAME")
                      password System.getenv("HYDRA_GITHUB_PAT")
                  }
              }
          }
      }
      

  2. Update the Application class name in your android/app/src/main/AndroidManifest.xml. By default, Flutter apps do not use a custom Application class in Android, but the SDK requires one for initialization. Find the tag and set its android:name attribute to "com.capillary.plugins.hydra.HydraApplication" as shown in this example:
    <application
        android:name="com.capillary.plugins.hydra.HydraApplication"
        ...>
    </application>
    

    📘

    Note

    If you are using your own Application class or plan to use another CMS, follow the steps in the Advanced Android setup documentation instead of this step.

  3. Set an AppCompat theme for your application in your AndroidManifest.xml. The SDK requires that your application theme is set to an AppCompat theme. If your app's theme is not already set to an AppCompat theme, add or update the android:theme attribute within the tag as shown in this example:
    <application
        ...>
        android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"
    >
    </application>