safaricom / LNMOnlineAndroidSample

Lipa Na MPESA Online (STK Push) Android Sample Application. This app demonstrates an e-commerce purchase and checkout process via Mpesa and Daraja :smile:
https://developer.safaricom.co.ke/
Apache License 2.0
127 stars 129 forks source link

Runtime errors #25

Closed Patrick-Elvis closed 5 years ago

Patrick-Elvis commented 5 years ago

error: self-reference in initializer This is the error I get when I try running the app no

klvnmarshall commented 5 years ago

I'm having this issue too.I'm yet to figure it out

klvnmarshall commented 5 years ago

The issue is in the following lines of code in the build. gradle app module buildTypes.each { it.buildConfigField 'String', 'CONSUMER_KEY', 'CONSUMER_KEY' it.buildConfigField 'String', 'CONSUMER_SECRET', 'CONSUMER_SECRET' }

Change the parameter values according to the values given in the Safaricom developers site

IMPORTANT

If you are setting a new String variable, you should use the \" to set the quotation marks to your new variable. So, if I'm setting a String, I should modify the PARAM_VALUE to "\"My String\"" . This way, when gradle sets your String variable, it will set the quotation marks too.

Hope that helps.

kisese commented 5 years ago

@kelvinmarshall the issue is referenced here https://stackoverflow.com/questions/30796533/how-to-generate-buildconfigfield-with-string-type , thank you for the fix

klvnmarshall commented 5 years ago

Cool @kisese

Patrick-Elvis commented 5 years ago

Thank You