Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Gilad Solter
2,986 PointsError on FileHelper.java in "Adding a File to the Message"
I'm getting errors in those two lines: import org.apache.commons.io.IOUtils; //error: cannot resolve symbol io fileBytes = IOUtils.toByteArray(fileInput); //error: cannot resolve symbol IOUtils
I'm using android Studio and the code is exactly as shown in the video. I have added the commons library (I couldn't paste it in android studio so I pasted it directly to the folder).
There is a similar question in the forum from 5 months ago, but no one answered it.
Thanks.
1 Answer
Kevin Carroll
3,432 PointsHey Gilad,
I was having the same problem and someone else helped me with it. Adding compile files('libs/commons-io-2.4.jar') along with compile fileTree('src/main/libs') to the build.gradle file seems to have fixed it for me..I don't know why you need to set a command to compile that library separately, but it seems to have worked.
Gilad Solter
2,986 PointsGilad Solter
2,986 PointsWow that's weird! I tried to follow your instructions but something didn't worked. So I deleted the lines that I have just added and saved the file, cleaned the project and the error went away!
Kevin Carroll
3,432 PointsKevin Carroll
3,432 PointsActually, yeah, it looks like simply updating build.gradle (which causes it to resync) fixes the problem. It's possible that simply going to Tools->Android->Sync Project With Gradle Files could fix this as well.