As of now (May 2014) if you use the default generated project it is actually amazingly simple (though difficult to find instructions!

Open the second level build.gradle, and add the following line to the dependencies {:

compile "commons-io:commons-io:+"

That will get the latest version of commons-io. My complete file looks like this:

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.0"

    defaultConfig {
        minSdkVersion 18
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile "commons-io:commons-io:+"
}
Answer from Timmmm on Stack Overflow
🌐
Gradle
discuss.gradle.org › old forum archive
"org.apache.commons.io.FileUtils" class is available for compile, but isn't available in runtime - Old Forum Archive - Gradle Forums
November 25, 2013 - This issue is similar to http://forums.gradle.org/gradle/topics/classes_in_buildsrc_throws_noclassdeffounderror_on_dependencies_defined_in_gradle_script I try to use class from “commons-io-1.4.jar” library in my custom task. If I don’t define any dependencies, I get successfull compile ...
Discussions

IllegalAccessErrors: "...FilenameUtils.isSystemWindows()Z from class org.apache.commons.io.FileUtils"
Hello, since several day I am running into IllegalAccessErrors. Gradle terminates with tried to access method org.apache.commons.io.FilenameUtils.isSystemWindows()Z from class org.apache.commons.io.FileUtils Complete stacktrace is below. The error message is the same than the one reported in ... More on discuss.gradle.org
🌐 discuss.gradle.org
0
0
April 8, 2016
Java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
I use a custom Gradle plugin which ... from inside the plugin; I run the same task and build failes with java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils thrown from the plugin.... More on discuss.gradle.org
🌐 discuss.gradle.org
0
0
November 11, 2015
java - Using Apache Commons IO in a Gradle project - Stack Overflow
I'm writing a Java program - a plain command line program, not Android or anything like that - using Gradle, and trying to include Apache Commons IO. Per https://mvnrepository.com/artifact/commons-io/ More on stackoverflow.com
🌐 stackoverflow.com
Writing and using a custom task with third party dependencies - Old Forum Archive - Gradle Forums
I have a custom task in a sub project build script in Groovy. It uses a third party library components FileUtils from commons-io. In my build script I'm getting the following error on the import line: unable to resolve c… More on discuss.gradle.org
🌐 discuss.gradle.org
0
December 5, 2014
🌐
Gradle
issues.gradle.org › browse › GRADLE-2963
[#GRADLE-2963] "org.apache.commons.io.FileUtils" class is available for compile, but isn't available in runtime
March 31, 2015 - This issue is similar to [1]http://forums.gradle.org/gradle/topic · I try to use class from "commons-io-1.4.jar" library in my custom task. If I don't define any dependencies, I get successfull compile and "ClassNotFoundException" error on execution. If I copy "commons-io-1.4.jar" into "lib" ...
🌐
Gradle
discuss.gradle.org › help/discuss
IllegalAccessErrors: "...FilenameUtils.isSystemWindows()Z from class org.apache.commons.io.FileUtils" - Help/Discuss - Gradle Forums
April 8, 2016 - Hello, since several day I am running into IllegalAccessErrors. Gradle terminates with tried to access method org.apache.commons.io.FilenameUtils.isSystemWindows()Z from class org.apache.commons.io.FileUtils Complete stacktrace is below. The error message is the same than the one reported in this issue. gradle buildEnvironment delivers following classpath: classpath ±-- gradle.plugin.com.github.eerohele:dita-ot-gradle:0.2.1 — commons-io:commons-io:2.4 Because of the linked issue, I ...
🌐
Gradle
discuss.gradle.org › help/discuss
Java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils - Help/Discuss - Gradle Forums
November 11, 2015 - I use a custom Gradle plugin which utilises the commons-io library from a Gradle distribution via gradleApi(). Currently my project build behaves in a very strage way: I run a task from the plugin and build failes with an expected exception from inside the plugin; I run the same task and build failes with java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils thrown from the plugin.
🌐
Jar-Download
jar-download.com › home › commons-io › commons-io › 2.5 › source code › fileutils.java
org.apache.commons.io.FileUtils Maven / Gradle / Ivy
org.apache.commons.io.FileUtils maven / gradle build tool code. The class is part of the package ➦ Group: commons-io ➦ Artifact: commons-io ➦ Version: 2.5
🌐
Gradle
discuss.gradle.org › old forum archive
Writing and using a custom task with third party dependencies - Old Forum Archive - Gradle Forums
December 5, 2014 - I have a custom task in a sub project build script in Groovy. It uses a third party library components FileUtils from commons-io. In my build script I’m getting the following error on the import line: unable to resolve class org.apache.commons.io.FileUtils.
Find elsewhere
🌐
GitHub
github.com › gradle › gradle › blob › master › platforms › core-runtime › base-services › src › main › java › org › gradle › internal › FileUtils.java
gradle/platforms/core-runtime/base-services/src/main/java/org/gradle/internal/FileUtils.java at master · gradle/gradle
import org.apache.commons.io.FilenameUtils; import org.gradle.api.GradleException; · import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Locale; · public class FileUtils { public static final int WINDOWS_PATH_LIMIT = 260; ·
Author   gradle
🌐
Stack Overflow
stackoverflow.com › questions › 38640592 › apache-commons-io-dependency-error-in-build-gradle
java - Apache commons-io dependency error in build.gradle - Stack Overflow
FileUtils.writeStringToFile(File, String with data); FileUtils.writeStringToFile(File, String with data, String encoding); The eclipse showing 'method doesn't exist' error. So I have updated my build.gradle dependency as below: compile group: 'commons-io', name: 'commons-io', version: '2.4'
🌐
Gradle
discuss.gradle.org › help/discuss
Gradle Script unable to compile groovy file - Help/Discuss - Gradle Forums
March 21, 2017 - After adding dependency also still build is failing. Please find the below error unable to resolve class org.apache.commons.io.FileUtils unable to resolve class groovyx.net.http.RESTClient build.gradle : buildscript { repositories { mavenCentral() maven { url ‘http://dl.bintray.com/gesellix/docker-utils’ } } dependencies { classpath 'org.apache.commons:commons-io:1.3.2' classpath files('C:\\Users\\xxx\\Downloads\\docker-client-master\\client\\build\\libs\\client.jar') class...
🌐
Apache Commons
commons.apache.org › proper › commons-io › dependency-info.html
Maven Coordinates – Apache Commons IO
April 8, 2025 - Apache Commons, Apache Commons IO, Apache, the Apache logo, and the Apache Commons project logos are trademarks of The Apache Software Foundation.
🌐
Maven Repository
mvnrepository.com › artifact › commons-io › commons-io
Maven Repository: commons-io » commons-io
April 19, 2026 - The Apache Commons IO library contains utility classes, stream implementations, file filters, file comparators, endian transformation classes, and much more. ... aar android apache api arm assets build build-system bundle client clojure cloud config cran data database eclipse example extension ...
🌐
LabEx
labex.io › tutorials › java-how-to-import-apache-commons-library-450979
How to import Apache Commons library | LabEx
import org.apache.commons.io.FileUtils; import java.io.File; public class FileDemo { public static void main(String[] args) throws Exception { File sourceFile = new File("/path/to/source"); File destFile = new File("/path/to/destination"); FileUtils.copyFile(sourceFile, destFile); FileUtils.deleteQuietly(sourceFile); } } import org.apache.commons.collections4.CollectionUtils; import java.util.List; import java.util.ArrayList; public class CollectionDemo { public static void main(String[] args) { List<String> list1 = new ArrayList<>(); List<String> list2 = new ArrayList<>(); list1.add("Apple");
🌐
Gradle
discuss.gradle.org › old forum archive
Using ProjectBuilder in Junit 4 Test Throws java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.deleteQuietly(Ljava/io/File;)Z - Old Forum Archive - Gradle Forums
December 30, 2014 - I am working on a Gradle Plugin that is built against the Android Gradle Plugin. I am trying to write unit tests for hit. Whenever I use ProjectBuilder to mock a project instance I get the following crash. java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.deleteQuietly(Ljava/io/File;)Z at org.gradle.internal.nativeintegration.filesystem.services.GenericFileSystem.
🌐
Baeldung
baeldung.com › home › java › java io › apache commons io
Apache Commons IO | Baeldung
January 8, 2024 - Simply put, utility classes provide sets of static methods that can be used to perform common tasks on files. This class provides different operations on files, such as opening, reading, copying, and moving.
🌐
Reddit
reddit.com › r/androiddev › i need help with a tutorial - including the common io library
r/androiddev on Reddit: I need help with a tutorial - Including the Common IO library
July 6, 2014 -

Hi,

I'm stuck with this (=Todo app step-by-step with Android Studio) tutorial.

Slide #18 has a note that says to import the Apache Common IO library to use the FileUtils class. I followed the link to download the library. I chose the download link from version 2.4 of the library under the binary section. I unpacked the *.jar files which were included in the zip file into the lib folder of my Android Studio project folder.

The problem is that Android Studio doesn't seem to recognize the library and underlines the FileUtils class and suggests to create a class with that name instead of importing the class from the library.

Do I have to do something additionally?

🌐
GitHub
github.com › shazam › fork › issues › 37
NoSuchMethodError: org.apache.commons.io.FileUtils.getFile(Ljava/io/File;[Ljava/lang/String;)Ljava/io/File; · Issue #37 · shazam/fork
April 16, 2015 - > org.apache.commons.io.FileUtils.getFile(Ljava/io/File;[Ljava/lang/String;)Ljava/io/File; * Try: Run with --debug option to get more log output. * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':express:forkDebug'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTask
Author   shazam
🌐
Maven Repository
mvnrepository.com › artifact › commons-io › commons-io › 2.6
Maven Repository: commons-io » commons-io » 2.6
October 15, 2017 - The Apache Commons IO library contains utility classes, stream implementations, file filters, file comparators, endian transformation classes, and much more.
Published   Oct 15, 2017
Version   2.6
🌐
Maven Repository
mvnrepository.com › artifact › commons-io › commons-io › 2.4
Maven Repository: commons-io » commons-io » 2.4
June 12, 2012 - The Apache Commons IO library contains utility classes, stream implementations, file filters, file comparators, endian transformation classes, and much more.
Published   Jun 12, 2012
Version   2.4