anyway/frontend/android/README.md
Remy Moll 040e5c9f83
Some checks failed
Build and push docker image / Build (pull_request) Failing after 2m10s
Build and release APK / Build APK (pull_request) Successful in 6m34s
Build web / Build Web (pull_request) Successful in 1m42s
cleaner ci
2024-06-07 10:44:37 +02:00

1.6 KiB

Android Setup

Keystore setup

keytool -genkey -v -keystore release.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias release
  • This is required to store local credentials securely (not used for now).
  • But necesseary in order to restrict the particular api key to a particular app (through the sha1 of the associated keystore).

Building and secret credentials

Following the guide under https://developers.google.com/maps/flutter-package/config#android_1.

  • Add the following to android/build.gradle:
    buildscript {
        dependencies {
            classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1"
        }
    }
    
  • Add the following to android/app/build.gradle:
    plugins {
        // ...
        id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
    }
    
  • Add the credentials to android/secrets.properties:
    MAPS_API_KEY=YOUR_API_KEY
    
  • Reference the credentials in android/app/src/main/AndroidManifest.xml:
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="${MAPS_API_KEY}" />
    

Using the credentials in CI

  • Add the base64 encoded credentials to the repository secrets (e.g. ANDROID_SECRETS).
    base64 -i android/secrets.properties
    
  • Use the following in the CI script:
    echo {{ secrets.ANDROID_SECRETS }} | base64 -d > android/secrets.properties