Protect API KEY in Android Development

 in build.gradle -> android -> defaultConfig write this code:

Properties properties = new Properties() properties.load(project.rootProject.file("local.properties").newDataInputStream()) buildConfigField "String", "API_KEY", "\"${properties.getProperty("API_KEY")}\""

in local.properties, write your api key

API_KEY=your_api_key

and then sync and rebuild project


to use, just called BuildConfig.API_KEY

Komentar

Postingan populer dari blog ini

Learn CRUD with Room Android Kotlin