I am working on a Google Udacity course for the new Android Devs, and I ran into some problems with the Gradle construct and defining a constant in it. I tried to surround the field with several options "," and "\", which, as I said, is recommended on the Internet, but nothing works. I was wondering how to format the string inside buildTypes.each seen here?
buildTypes.each { it.buildConfigField "String", "OPEN_WEATHER_MAP_API_KEY", **APICodeHere** }
Here is all the code for the Gradle build application.
android { compileSdkVersion 21 buildToolsVersion "21.1.2" defaultConfig { applicationId "com.example.android.sunshine.app" minSdkVersion 10 targetSdkVersion 21 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } buildTypes.each { it.buildConfigField "String", "OPEN_WEATHER_MAP_API_KEY", **APICodeHere** } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21.0.2' }
Thanks!!!
source share