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 Blog Reader Android App Weird ERROR

Hi I have been following the Blog reader app tutorials and I'm having a small yet very weird problem. I'm following the tutorial but am putting a little twist on it by making it list different exercises. So for this, I built my own json file. Now I have gotten all the json titles to show all correctly and well in emulator, but when i put it on my phone it doesn't work (throws me a JSONException - Unterminated String...). But the weird part is, this only happens when I put it on my shared mochahost.com hosting server. When I put it somewhere else like on 000webhost.com free account, everything works. Is there something that needs to be set on the servers to allow access? And if so, how come the emulator can access it and not the phone? Thanks!

4 Answers

Hi there, have you tried modifying the permissions of the file? Usually service providers allow this through requesting permission change via email or something alike.

Yup just checked permissions on both the servers...they are exactly the same, 644.

Try with 755 for the one which does not work.

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

That JSONException occurs sometimes because of a bug in the code, actually. Check out this earlier Forum post and see if it addresses your issue: https://teamtreehouse.com/forum/parsing-data-returned-in-json-jsonexception-unterminated-string-at-character-5792