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

Android

Error in FileHelper.java

I keep getting this error in fileHelper uploaded on GitHub by Ben. and cant find a way to solve it...

error i get is here `` else { try { File file = new File(uri.getPath()); FileInputStream fileInput = new FileInputStream(file); fileBytes = IOUtils.toByteArray(fileInput); } catch (IOException e) { Log.e(TAG, e.getMessage());

`` i get error here : fileBytes = IOUtils.toByteArray(fileInput);

IOUtils cannot be resolved

Help would be apriciated :D

Thanks for your time :D

6 Answers

Timothy Boland
Timothy Boland
18,237 Points

I had the same problem in Android Studio....When I copied the file over, AS was importing from:

import com.google.android.gms.internal.io.IOUtils;

after changing to:

import org.apache.commons.io.IOUtils;  

the error went away :-)

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

You need the Apache Commons IO jar. See the Teacher Notes and the 2:55 mark in this video

I have downloaded and copied into libs directory commons-io-2.4.jar file but i still have error there.

ok i found the problem. thanks for your time ben :D

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Great - glad you got it working! If you have a minute, what was the issue? Might help other students in the future.

Actualy i dont' know it just sudenley started working right, i had to reset eclipse and computer but then it worked, i guess there was a problem when i coppied Apache commons IO.jar and needed to reset the computer :D

Gilad Solter
Gilad Solter
2,986 Points

I'm having the same problem, but restarting Android Studio and my computer didn't do the trick.... Any thoughts?

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Hi Gilad, if you're still having trouble, can you post a new thread in the Forum and paste in details from your build.gradle file?