Задача: приложение : compilededebugkotlin не удастся
e: {имя файла и строка в коде} неразрешенная ссылка 'android_id'. Строка с ошибкой: < /p>
Код: Выделить всё
class SomeActivity: ComponentActivity() {
private val androidId = BuildConfig.ANDROID_ID
// Rest of the code...
}
Код: Выделить всё
import com.android.build.api.dsl.Packaging
import java.io.FileInputStream
import java.util.Properties
val keyPropertiesFile = rootProject.file("keys.properties")
val keyProperties = Properties()
keyProperties.load(FileInputStream(keyPropertiesFile))
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
id("com.google.gms.google-services")
}
android {
// some properties ...
buildFeatures {
buildConfig = true
}
defaultConfig {
// some properties ...
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "ANDROID_ID", keyProperties.getProperty("ANDROID_ID"))
}
// other stuff ...
}
dependencies {
// dependencies ...
}
Код: Выделить всё
ANDROID_ID = "my ID"
Что происходит и что мне делать? п>
Подробнее здесь: https://stackoverflow.com/questions/793 ... uildconfig
Мобильная версия