Невозможно получить доступ к ключу API с помощью BuildConfigAndroid

Форум для тех, кто программирует под Android
Anonymous
Невозможно получить доступ к ключу API с помощью BuildConfig

Сообщение Anonymous »

Я использую секреты-град-плугин для чтения клавиш API, которые я поместил в свой локальный.

Код: Выделить всё

buildscript {
dependencies {
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0"
}
}
для приложения build.gradle

Код: Выделить всё

plugins {
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}

android {
compileSdk 31
...
}
И это мой local.properties

Код: Выделить всё

## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#
sdk.dir=/Users/xxx/Library/Android/sdk
apiKey=YOUR_API_KEY
Затем, когда я попытался получить доступ к нему из любого класса/приложения buildconfig.apikey нет. Я упускаю здесь какие -либо шаги? Пытался несколько часов, но не находил никакого способа сделать эту работу.

Подробнее здесь: https://stackoverflow.com/questions/709 ... uildconfig

Вернуться в «Android»