GithubHelp home page GithubHelp logo

Comments (66)

javiexpo avatar javiexpo commented on June 16, 2024 3

You can also use the gradle.properties file tu define the constant MyOpenWeatherMapApiKey like this:

MyOpenWeatherMapApiKey = "abcdefg0123456"

And the project will sync without problem

from sunshine-version-2.

Cattalins avatar Cattalins commented on June 16, 2024 1

Yes, I know, but sadly when this get fixed, I will return to my anonymity.
Hahaha

from sunshine-version-2.

tkinetik1 avatar tkinetik1 commented on June 16, 2024 1

AMEN!

from sunshine-version-2.

thaibt avatar thaibt commented on June 16, 2024 1

Hi I have this problem with buildTypes.each

Error:(21, 0) Gradle DSL method not found: 'buildConfigField()'
Possible causes:

  • The project 'Sunshine' may be using a version of Gradle that does not contain the method.
    Gradle settings
  • The build file may be missing a Gradle plugin.
    Apply Gradle plugin
  • And no, I am not missing a comma.

from sunshine-version-2.

peterqz avatar peterqz commented on June 16, 2024 1

Also this works:
it.buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY', ""abcdefg0123456""

from sunshine-version-2.

vikitripathi avatar vikitripathi commented on June 16, 2024 1

it helped !

from sunshine-version-2.

sidvenu avatar sidvenu commented on June 16, 2024 1

@tal32123 and others who are looking why defining MyOpenWeatherMapApiKey in gradle.properties doesn't work. The people at Udacity tells us to create gradle.properties in .gradle directory. But there is already in the normal project folder.(C/Users/.../Sunshine/gradle.properties). Put MyOpenWeatherMapApiKey="{YOURKEYHERE}" there and replace {YOURKEYHERE} with your key. and then leave the build.gradle file as it is as they gave here at github. It will work

from sunshine-version-2.

technoplato avatar technoplato commented on June 16, 2024 1

@SiddharthVenu The reason why you shouldn't put your API key in your project's (C/Users/.../Sunshine/gradle.properties) is because gradle recommends that file being checked in to version control. If you have your API key in that file, you shouldn't check it into version control. If you put your API key in your GLOBAL gradle.properties (~/.gradle/gradle.properties), it will be recognized by your project's build.gradle, but won't be checked into version control, which is really the goal here.

Does that make sense?

from sunshine-version-2.

technoplato avatar technoplato commented on June 16, 2024 1

@SiddharthVenu Uh oh! Shoot me an email ([email protected]) and I'll help you fix that!

from sunshine-version-2.

smsubham avatar smsubham commented on June 16, 2024 1

thanks for this solution , saved me hours of frustration.

from sunshine-version-2.

Josephaguele avatar Josephaguele commented on June 16, 2024 1

Thanks,
I really appreciate. The key you gave to me worked. Please can I just use
it for the practical sessions. Please

On Mon, Aug 1, 2016 at 10:14 PM, Ali Makhion [email protected]
wrote:

@Josephaguele https://github.com/Josephaguele this is the working code
you add these lines exactly as it is in build.gradle file inside the
android { } and this is my code
`apply plugin: 'com.android.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' , MyOpenWeatherMapApiKey
}

}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.2'
}
`

and you must have a working api Key for the sunshine app to work and this
is my key " 3194b70c58f9e0bc45d2279c1696c587 " if you wish to use it

and to must add your api key to the gradle.properties file located in
C:\Users\your username.gradle in windows and in your Home directory in mac
and here is the code in my gradle.properties file

org.gradle.daemon=true
MyOpenWeatherMapApiKey="3194b70c58f9e0bc45d2279c1696c587"

if you need any help i'm here


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#69 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ATrEqSFZ5i5TaiKygsdNDwz37qdkbuyFks5qbmGlgaJpZM4GRqq-
.

from sunshine-version-2.

kavoos avatar kavoos commented on June 16, 2024 1

If you create (global) gradle.properties yourself, you should make a PROPERTIES FILE and not TEXT DOCUMENT (via notepad or something like that!)
Your gradle.properties should be like this:
after
and it must be in C:\Users[user name].gradle
It contains: MyOpenWeatherMapApiKey="xxxx1111xxxx"
Your build.gradle should be like this:
...
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildTypes.each {
it.buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY', MyOpenWeatherMapApiKey
}
...

from sunshine-version-2.

jasjasbinks avatar jasjasbinks commented on June 16, 2024

Thank you Cattalins, I also encountered this hiccup :)

from sunshine-version-2.

a1g0rithm avatar a1g0rithm commented on June 16, 2024

I agree Cattalins. Part of being a good coder is using comments to help clarify what the previous code means.

from sunshine-version-2.

morfioce avatar morfioce commented on June 16, 2024

That was starting to bother me and then I read this, so thank you Cattalins

from sunshine-version-2.

zmckenney avatar zmckenney commented on June 16, 2024

Wow, thank you for this post! This was something I also ran into that bothered me. Thanks for the information!

from sunshine-version-2.

dragon9001 avatar dragon9001 commented on June 16, 2024

I get stuck at the same situation. Thanks so much!!! cattallins

from sunshine-version-2.

DClayton12 avatar DClayton12 commented on June 16, 2024

@Cattalins Good catch and Thank you! I was searching errors using gradle as the error was not obvious.

from sunshine-version-2.

asheshb avatar asheshb commented on June 16, 2024

Thanks a lot Cattalins. That was very helpful and time saving.

from sunshine-version-2.

JerryZaz avatar JerryZaz commented on June 16, 2024

On the bright side, getting this fixed was also a learning experience and YOU get to say that you did it without this post! You're awesome!

from sunshine-version-2.

bavly avatar bavly commented on June 16, 2024

thank you Cattalins very much this helped me

from sunshine-version-2.

nammshub avatar nammshub commented on June 16, 2024

Thank you so much for your help :)

from sunshine-version-2.

dbwest avatar dbwest commented on June 16, 2024

that helped so much. Should've guessed to have done that when I saw the code it generated...

from sunshine-version-2.

shrenuj avatar shrenuj commented on June 16, 2024

Earlier,I quit the tutorial coz android studio wont let me run the app coz of this gradle quotes issue.
Thanks a lot!

from sunshine-version-2.

thaibt avatar thaibt commented on June 16, 2024

For some reason, my gradle built only works when I simulate through a virtual phone, not my galaxy.... Which was weird because it was compatible.

On Dec 26, 2015, at 11:01 PM, shrenuj [email protected] wrote:

I quit the tutorial coz android studio wont let me run the app coz of this gradle quotes issue.


Reply to this email directly or view it on GitHub.

from sunshine-version-2.

sachinrkeche avatar sachinrkeche commented on June 16, 2024

Good Catch..

from sunshine-version-2.

lucasassalti avatar lucasassalti commented on June 16, 2024

Thank u =)

from sunshine-version-2.

lishuopitt avatar lishuopitt commented on June 16, 2024

This link may be helpful http://stackoverflow.com/questions/33365650/cannot-resolve-symbol-c882c94be45fff9d16a1cf845fc16ec5

from sunshine-version-2.

ratulbside avatar ratulbside commented on June 16, 2024

This helps me a lot .. :)

from sunshine-version-2.

javadKarbasian avatar javadKarbasian commented on June 16, 2024

Thanks a lot

from sunshine-version-2.

Polyterative avatar Polyterative commented on June 16, 2024

This helped me a lot, thanks!!!

from sunshine-version-2.

tusharbanne avatar tusharbanne commented on June 16, 2024

I should have seen this before figuring out what the problem is. It would have saved a lot of time.

from sunshine-version-2.

 avatar commented on June 16, 2024

Thank you so much for this post, i have spent last 2 hrs fixing this issue.

from sunshine-version-2.

 avatar commented on June 16, 2024

Thanks a lot Cattalins

from sunshine-version-2.

 avatar commented on June 16, 2024

buildTypes.each {
it.buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY', ""c882c94be45fff9d16a1cf845fc16ec5""
}
//me a funcionado!!!

from sunshine-version-2.

tal32123 avatar tal32123 commented on June 16, 2024

How does one use this code:

MyOpenWeatherMapApiKey = "abcdefg0123456"

it doesn't seem to work for me.

from sunshine-version-2.

 avatar commented on June 16, 2024

from sunshine-version-2.

tal32123 avatar tal32123 commented on June 16, 2024

Thanks for your response, what is the point of this code then in the gradle properties file?:

MyOpenWeatherMapApiKey = "abcdefg0123456"

from sunshine-version-2.

keysona avatar keysona commented on June 16, 2024

Thanks!
I also met this problem!
I just add single quote...

from sunshine-version-2.

DroidPulkit avatar DroidPulkit commented on June 16, 2024

Thank you so Much
It solved the problem

from sunshine-version-2.

Abhi0725 avatar Abhi0725 commented on June 16, 2024

Thanks

from sunshine-version-2.

BrunoCodex avatar BrunoCodex commented on June 16, 2024

Thanks 💯

from sunshine-version-2.

cp-jones avatar cp-jones commented on June 16, 2024

Thanks! Spent about an hour looking for this fix!

from sunshine-version-2.

Heleni avatar Heleni commented on June 16, 2024

Thanks a lot!

from sunshine-version-2.

baishali-ghosh avatar baishali-ghosh commented on June 16, 2024

Thanks a lot. Got stuck here, kept applying " " and it still wouldn't render correctly in the build config. You saved me a lot of time.

from sunshine-version-2.

technoplato avatar technoplato commented on June 16, 2024

There's going to be a change coming that will make this process much more clear! Sorry for the current confusion. I agree, single quotes surrounding double quotes is very confusing.

from sunshine-version-2.

alketola avatar alketola commented on June 16, 2024

Thank you, you saved my day! Started pondering about this a fed days ago...

  • However, I consider this a very educative catch. ;-)

from sunshine-version-2.

sidvenu avatar sidvenu commented on June 16, 2024

@halfjew22 But it does not recognize the variable if I put it in ~/.gradle

from sunshine-version-2.

ahewlett avatar ahewlett commented on June 16, 2024

I just encountered this, thank you for posting the solution.

from sunshine-version-2.

poph2 avatar poph2 commented on June 16, 2024

@Cattalins Your name has been engraved electronic stones of android history. You will not be forgotten.

from sunshine-version-2.

jmkuruvilla avatar jmkuruvilla commented on June 16, 2024

Thank you! That saved some headache.

from sunshine-version-2.

Josephaguele avatar Josephaguele commented on June 16, 2024

Why does it (OPEN_WEATHER_MAP_API_KEY) have to be written like this?
And what is the effect of having to code in the build area?

Please I need an answer to this questions

from sunshine-version-2.

AliHG avatar AliHG commented on June 16, 2024

@Josephaguele : naming OPEN_WEATHER_MAP_API_KEY like this will make no difference you can name it as you like but when you call it in your code "FetchWeatherTask" class BuildConfig.OPEN_WEATHER_MAP_API_KEY; make sure to change the name here too

from sunshine-version-2.

AliHG avatar AliHG commented on June 16, 2024

@Cattalins i'm pretty sure this is not how it's done

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

and MyOpenWeatherMapApiKey is like calling a variable you declared in gradle.propertie

MyOpenWeatherMapApiKey="3194b70c58f9e0bc45dfd2279c1696c587"
in gradle.properties file your .gradle folder in your home directory

when adding your api key in your build.gradle file you risk when using github t

from sunshine-version-2.

Josephaguele avatar Josephaguele commented on June 16, 2024

I tried coding it like everyone has said, but it hasn't worked for me yet because when I try to run the sunshine app, it still shows the run time error.
Is this not the correct code?

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

Please can anyone help me out with this. And please must we have a correct and working API key before the Sunshine app will work?

from sunshine-version-2.

AliHG avatar AliHG commented on June 16, 2024

@Josephaguele this is the working code you add these lines exactly as it is in build.gradle file inside the android { } and this is my code
`apply plugin: 'com.android.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' , MyOpenWeatherMapApiKey
}

}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.2'
}
`

you only add

buildTypes.each { it.buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY' , MyOpenWeatherMapApiKey }
in the correct place inside the android { } scope and don't change any thing else in this file and click sync now

and you must have a working api Key for the sunshine app to work and this is my key " 3194b70c58f9e0bc45d2279c1696c587 " if you wish to use it

and to must add your api key to the gradle.properties file located in C:\Users\your username.gradle in windows and in your Home directory in mac and here is the code in my gradle.properties file

org.gradle.daemon=true MyOpenWeatherMapApiKey="3194b70c58f9e0bc45d2279c1696c587"

if you need any help i'm here

from sunshine-version-2.

AliHG avatar AliHG commented on June 16, 2024

@Josephaguele it's yours 👍

from sunshine-version-2.

Uiyama avatar Uiyama commented on June 16, 2024

Thanks a lot. I really appreciate.

from sunshine-version-2.

Josephaguele avatar Josephaguele commented on June 16, 2024

Hi,

Please Is there any way I can get an updated explanation of Postal Code
Param. I really do not understand it .
I would be very grateful.
Thanks in anticipation.

On Sat, Aug 6, 2016 at 3:19 PM, Codenal [email protected] wrote:

Thanks a lot. I really appreciate.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#69 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ATrEqTXqJ8wdvDtC2M-8aWBtYG4Xko5pks5qdJgKgaJpZM4GRqq-
.

from sunshine-version-2.

Josephaguele avatar Josephaguele commented on June 16, 2024

Please my android monitor screen is not showing the information as shown in the tutorial.
When I click the refresh button, this is what shows up on my screen.
capture
I hope this will do well.
The last two lines, which is the InputManager is what shows up on my android studio monitor screen when I click the refresh button

from sunshine-version-2.

seiya021 avatar seiya021 commented on June 16, 2024

Thank's Cattalins

from sunshine-version-2.

Josephaguele avatar Josephaguele commented on June 16, 2024

Thank you

On Sat, Oct 8, 2016 at 5:55 AM, seiya021 [email protected] wrote:

Thank's Cattalins


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#69 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ATrEqe2qmkzYrY8xQnZA0DldBniDbm2Fks5qxyJfgaJpZM4GRqq-
.

from sunshine-version-2.

omerboyraz avatar omerboyraz commented on June 16, 2024

Thank you for help.

from sunshine-version-2.

rag-lab avatar rag-lab commented on June 16, 2024

ok, when changing the build.gradle file double check you inserted the code in the correct one. there's 2 here (Project and app), the code should be on the build.grade (app)

from sunshine-version-2.

sachinrkeche avatar sachinrkeche commented on June 16, 2024

from sunshine-version-2.

AMT16 avatar AMT16 commented on June 16, 2024

Thank you , that was helpful

from sunshine-version-2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.