Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Getting OpenWeatherMapApi error while building #159

Closed
khat33b opened this issue Feb 16, 2016 · 9 comments
Closed

Getting OpenWeatherMapApi error while building #159

khat33b opened this issue Feb 16, 2016 · 9 comments

Comments

@khat33b
Copy link

khat33b commented Feb 16, 2016

I am getting an error in build.gradle in the line below after downloading the final project. This is the first time I am building the project after downloading the zip file.

    buildTypes.each {
        it.buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY', MyOpenWeatherMapApiKey
    }

The error is:

Error:(21, 0) Could not find property 'MyOpenWeatherMapApiKey' on com.android.build.gradle.AppExtension_Decorated@28a8005d.

@exagil
Copy link

exagil commented Feb 16, 2016

You need to generate an OpenWeatherMapApiKey from openweathermap.org and paste it at the required location

@khat33b
Copy link
Author

khat33b commented Feb 16, 2016

That worked. Thanks!

@khat33b khat33b closed this as completed Feb 23, 2016
@robophil
Copy link

Where is the required location, cos am still getting the same error after adding it

@nwaokoron
Copy link

#69

hope this helps

@josegl06
Copy link

I have the same error, I added the key but still don't work
error

@albaqawi
Copy link

This part of the course was poorly fixed after OpenWeathermap required to get an API key for each user.

the fix is easily found here in this post http://stackoverflow.com/questions/33226978/could-not-find-property-xxxx-on-com-android-build-gradle-appextension-decorate

either: Create the file
~/.gradle/gradle.properties (Win: %USERPROFILE%.gradle\gradle.properties). If gradle.properties does not exist - just create it.
In the file add following line:

MyOpenWeatherMapApiKey="XXXXXXXXXXXYOUR API KEY AFTER YOU GET IT XXXXXXXXXXXXXXXXX"

OR

hard code the key in the line of code
it.buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY', '"xxxxxxxxxxxxxxxxxx"'

The link I shared has more details.

I hope this helps.

@xuezhaojun
Copy link

xuezhaojun commented Oct 10, 2016

before:

 buildTypes.each {
        it.buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY', MyOpenWeatherMapApiKey
    }

after:

buildTypes.each {
        it.buildConfigField 'String','OPEN_WEATHER_MAP_API_KEY',"\"xx2920cbac9a6733bd9bbb8573871226\""
    }

@Adityareddyp
Copy link

Is this project by Udacity-Google?

@MohamedRoushdy
Copy link

@Adityareddyp Yes it is. But it sounds they don't support it anymore.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants