I've been developing an App that uses FTP connection. In my first trials, and after lots (LOTS) of attempts, I could put the FTP to work (main problem was the libraries include). Now I developped the main frame of the App, and want to upload the data, and again, I can't include the library.
I'm using android studio, I have the libs folder, and the jar ins in there.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
compile files('libs/org.apache.commons.net.jar')
}
}
And in the class, I have the import statements
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
I've also added the jar as library within the project explorer, but I'm still getting a compile error:
Gradle: A problem occurred evaluating project ':Project_Name'.
No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile() is applicable for argument types: (org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection) values: [file collection]
Possible solutions: module(java.lang.Object)
I can't seem to get around this, I've tried many differents ways to import the library, and raided the net for a solution, but none seems to work, would appreciate your help.
Thanks in advance
PS:can someone point me to a good book/article regarding android application build process, as I would want to get really into it, so I don't have this pain-in-the-arse problems anymore.
EDIT1:
Logcat is giving me this, after sucessfully loading the library:
12-13 13:01:50.640 31172-31192/? E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-6502
java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
at com.example.dev_gpsreport1.FTPConnection.run(FTPConnection.java:35)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.net.ftp.FTPClient
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at com.example.dev_gpsreport1.FTPConnection.run(FTPConnection.java:35)
at java.lang.Thread.run(Thread.java:856)
The problem is I can see the declaration of the class.