Hello, due to the lack of a computer and the desire to keep up with the times, I decided to find a way to use third-party libraries in the Android IDE (AIDE). This application development application is right on your phone. I wanted to picasso and went here and downloaded the JAR archive from the library. Further, I did not find an opportunity to put this JAR into AIDE, so I came up with a life hack.
What I've done
I found that AIDE uses its own android.jar, which contains .class files. This archive contains all Java and Android classes, as well as a hierarchy by folder. It's clear that AIDE uses this archive to load imports.
I also discovered that the Picasso Library JAR archive is also a hierarchy of .class files. I have an idea.
Which one?
I just picked up and extracted from the archive folder com. Thus, the entire library (com.squareup.picasso. *) And carefully placed in the root of the android.jar archive. I added a new archive with the added library and launched AIDE. I go to the java file and write to the imports section
import com.squareup.picasso.*; Works! Next, I write (well, so that finally make sure)
Picasso.with(this) I did not add and check, because the syntax is highlighted, there are no errors. I wanted to share a blog idea on G +, but put it off. Now it's time to library. I decided to start with a simple one - display the image from a file on the device in ImageView . This line of code from the adapter, besides, I get the path to the image from the database, so the cursor is used
Picasso.with(context) .load(new File(cursor.getString(cursor.getColumnIndex(Helper.PATH)))) .into(holder.item_photo); I'm running. And then bang!
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/picasso/Picasso; ru.turbomedia.picassotest.MainActivity$ExpAdapter.getGroupView(MainActivity.java:376) Complains precisely this line
My guesses
Probably, the fact is that I made a stupid mistake and in vain manipulated the JAR source code. It seems to me that the library could not be added to android.jar. After all, a library is a set of classes and methods that work within themselves and do not depend on anything. And in android.jar there are something like .aidl files that are needed only for the development environment to display methods, constants, classes, interfaces, etc., etc. The environment compiles the code and it is already running on the device, as there is an API framework.
I made this conclusion thanks to the knowledge of creating firmware, but it may be incorrect.
What to do?
In this way I added not only Picasso , but other popular libraries, such as Retrofit , OkHttp , Gson and even found a site with maven-repositories and scored chrome bookmarks on the libraries you liked. There were both JAR and AAR archives, which I planned to add and use in the same way. But still checked in time. Is there any alternative working way to add libraries to AIDE?
PS - Do not offer to use the Clone GIT Repository , this is a solid rake, because a whole bunch of garbage for the studio is swinging and I'm really confused.
There is an option to manually copy the source code of the libraries into the project, but these are nerves, since the clipboard is not enough to copy all the code (if taken on the github) and you have to start all over again because of this. If you download JARs, then there will be compiled classes.