4

An Android app has the following in its build.gradle:

dependencies {
    ...
    compile 'commons-io:commons-io:2.4'
}

Building and installing the app has no problem. However the following code:

FileUtils.writeStringToFile(fText, "Test");

causes the the following exception:

java.lang.NoClassDefFoundError: com.google.repacked.apache.commons.io.FileUtils

Could anyone offer a tip on how to remedy this?

[Edit:]

I have just realized the app can still be built without the following in build.gradle:

dependencies {
    ...
    compile 'commons-io:commons-io:2.4'
}

FileUtils is the following: enter image description here

Could anyone tell what com.google.repacked is and how to get rid of it?

4
  • 1
    Quick guess, but it doesn't seem like you are using FileUtils from the commons lib. Double check your import statement to see where FileUtils is imported from. Commented May 14, 2016 at 2:10
  • @EricB. You are spot on. It use import com.google.repacked.apache.commons.io.FileUtils; As I asked in my new edit, what is com.google.repacked? It looks like a legitimate thing, but does not work. Commented May 14, 2016 at 2:16
  • 1
    I have no idea what that package is. My guess would be the commons-io repackaged by Google and included in some base Android libs. For your issue, just mark the import as org.apache...FileUtils Commented May 14, 2016 at 2:18
  • @EricB. Could you turn your comment into a answer so that I can accept it? Commented May 14, 2016 at 2:20

1 Answer 1

1

Quick guess, but it doesn't seem like you are using FileUtils from the commons lib. Double check your import statement to see where FileUtils is imported from.

Ensure that you are importing the org.apache...FileUtils class and not something from the com.google... package.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.