Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Weather App (2015) Building the Weather UI Finishing the Lower Half

App crashes because of OkHttp error

When I launch the app on my phone it opens and immediately crashes. Console says:

06-03 09:48:59.807 29573-29594/com.example.javierpacheco.stormy E/AndroidRuntime﹕ FATAL EXCEPTION: OkHttp Dispatcher Process: com.example.javierpacheco.stormy, PID: 29573 java.lang.IllegalArgumentException: Unknown pattern character 'n' at java.text.SimpleDateFormat.validatePatternCharacter(SimpleDateFormat.java:314) at java.text.SimpleDateFormat.validatePattern(SimpleDateFormat.java:296) at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:356) at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:249) at com.example.javierpacheco.stormy.CurrentWeather.getFormattedTime(CurrentWeather.java:87) at com.example.javierpacheco.stormy.MainActivity.getCurrentDetails(MainActivity.java:98) at com.example.javierpacheco.stormy.MainActivity.access$100(MainActivity.java:25) at com.example.javierpacheco.stormy.MainActivity$1.onResponse(MainActivity.java:61) at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:168) at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)

I just solved it. Seems like I put SimpleDateFormat("h:mn a"); while creating a new SimpleDateFormat object and apparently the "n" from the minutes must be removed; so it has to look like SimpleDateFormat("h:m a");