I want to create a jar file (there are no resources associated with it) using AndroidStudio that accesses our server APIs and will be used in several as yet unwritten Android apps. I also want to be able to test these APIs outside of an android app. It doesn't use any android libraries. My questions are 1) how do I configure gradle to just build a jar file? 2) What's the best way to exercise this code in AndroidStudio? Writing a small wrapper that includes a main function that imports the jar file? Writing a toy Android app that exercises the code? Or is my approach completely wrong?
If it doesn't use Android libraries, then why are you trying to create a .jar file in Android Studio? Just use ant. It's the same process as creating a .jar file for Volley, which is detailed in this SO question.
Related
I have many java class files written by me for common purposes which I need to use very often in my Android projects. These classes (let's call them 'library') has many static methods in them and I call these methods when I need them in my Android Studio projects without any problem
When I create a new Android Studio project I copy all those library files into the Java folder of my new project. So, I can call them with the syntax like classname.methodname() at any time in my projects (in activities, in other java classes, etc)
The question is that this technic causes many independent library files in each project. This means that, when I have added a new method or changed a method, I need to do the same thing at each library files in each project.
As I am new at Android Studio and I am playing with that at the moment, this might be ok. But in real life, this will be impossible in the near future while I was struggling with many projects.
I am sure that, there should be a way to use file links instead of inserting these library files by copying them into the Android projects. So, making changes in a source library file will affect all projects at once. Something like $I directive in the C type languages...
Is this possible and if yes, how?
Thank you...
One good way would be to create your own library/module in android studio.
Here is a link for that : https://developer.android.com/studio/projects/android-library
And another way would be to create your own JAR file.
For the past few days I've been trying to upload and download files from Google Drive using Java. I've seen some tutorials on the internet but they all used Gradle and I need to do this in Eclipse. I can't use Gradle because it does not work with other parts of the project.
Does anyone know how to upload/download files in Google Drive using Java (Eclipse Neon)? Thanks.
You can also use Maven or just simply add the Drive client library to your project. Check out this page for Maven/download links:
https://developers.google.com/api-client-library/java/apis/drive/v2
Once you have the necessary jar in your project, you should be able to follow the existing tutorials on how to use Drive, e.g.:
https://developers.google.com/drive/v2/web/examples/
I am making a game using a client-server model. Currently I have 3 projects: client, server, and common. Currently all of the resources for the game are in a folder inside the common project, which is recognised as a source folder by Eclipse.
This allows me to access the resources from within the client and server projects using:
InputStream in = SomeClass.class.getClassLoader().getResourceAsStream(filename);
The problem is that this method only works for reading the files, but I want to be able to write to these files, too (e.g. saving a level in the level editor).
I'm imagining the built project looking something like this:
Game/resources/...
Game/client.jar
Game/server.jar
Can anyone recommend a way that I can configure my project so that Eclipse will build it in this way, or in such a way that both the client and server will be able to access the shared resources?
can i use IPC mechanism via an AIDL file inside an android library project? in fact i want to use an android library jar file in my android application and i want that library connects to another application via an AIDL file. it's possible or i can use AIDL files just in regular android projects? right now in my android library when i want to import AIDL in my code, eclipse doesn't resolve it but in regular android application does it!
what's the problem?
I would like to replace android default sqlite build for a new one having rtree feature enabled. It looks like I have to use a java wrapper to accomplish that and the only one I found android compatible was sqlite4java. I prefer sticking with standards. Unfortunately I found out jdbc is not supported in dalvikvm (Androids VM) and native android.database.sqlite works with an rtree disabled build of sqlite.
Currently I have a new .so sqlite rtree enabled library compiled for android but would like to substitute androids native one without having to use a third party wrapper like sqlite4java. Any ideas? I was thinking about downloading android.database.sqlite package from android sdk and building a jar to substitute only the .so load withing my application context. Is that the best approach?
I was thinking about downloading android.database.sqlite package from android sdk and building a jar to substitute only the .so load withing my application context. Is that the best approach?
So long as you are willing to refactor all necessary classes into your own package, that is probably your only approach. For example, that is what SQLCipher for Android does. They cloned ~37 classes from android.database and android.database.sqlite and modified them to use their own SQLCipher-enabled build of SQLite.