Robospice jars for non maven mode - android

I'm trying to make a build of a sample project (core-basic), without maven, just by picking the jars located in repository/dependencies/1.4.9/robospice and copying them to Android project libs folder.
The jars that I am copying are specifically these:
commons-io-1.3.2
commons-lang3-3.1
robospice-1.4.9
robospice-cache-1.4.9
However, Eclipse shows this error:
robospice-sample-core/libs/commons-lang3-3.1.jar' in project 'robospice-sample-core' cannot be read or is not a valid ZIP file
Moreover, I cannot access into the contents of the jars, WinRar says that they are corrupted or invalid.
So, what am I doing wrong? Can I really use those jar just by copying them to libs folder or do I have to do something more? Why does eclipse say that they can not be read?
(Thanks in advance. In spite of I know that maven setup for Robospice is strongly advisable, I'd like to know why this happens)

Downloading jar by means of right click on its file name --> Save link returns corrupted jar files. Clicking on "Raw" in the file details, return the correct file.

You must have made a mistake while downloading the files. They can be opened pretty easily with zipinfo on my mac. Download them again from the repo branch or pick the artifacts from maven central.

Related

ini4j only works from the libs directory, not maven

I'm trying to use ini4j in an Android app, compiled in the AIDE IDE. When I put ini4j-0.5.4.jar in the libs folder in my app, it works. However, when I include ini4j with the line compile 'org.ini4j:ini4j:0.5.4' in my build.gradle, I get the error bad utf-8 byte a0 at offset 00000004. I've checked the jar file in the Maven directory, and it is identical to the one in my libs folder. Both have the SHA1 4a3ee4146a90c619b20977d65951825f5675b560. I have absolutely no clue what could be causing this.
EDIT: For some reason, it seems to have xerces as a dependency, which is the library known to have these issues.
According to Apache (http://xerces.apache.org/xerces2-j/install.html) xerces.jar is now deprecated and renamed to xercesImpl.jar, so you have to stick to the old JAR.
xerces.jar is no longer available in the main distribution. You can still download this jar from deprecated distribution. xerces.jar is a Jar file that contains all the parser class files (i.e., it contains the intersection of the contents of xercesImpl.jar and xml-apis.jar).
To be clearer, the technical details are:
The old xerces.jar you have in your libs folder is working, because of the internal folder structure.
The new xerces from the repository has a different folder structure and some weird UTF encoded bytes AIDE is not understanding.

Android Volley : comes with a .gitignore

I have just uploaded my Android Project to my github repo and noticed that the volley folder is greyed out and can't be accessed.
So I took a closer look at my volley folder, inside my MyApplication folder and noticed a .gitignore file in it. Funny thing tho I didn't create the file. Is there a reason for this? Shouldn't I get rid of this file and upload my volley folder?
If someone downloads my Project and tries to run it, Android Studio will probably look for a volley folder that just isn't there?.. Am I missing something or ?
Thank you!
.gitignore is automatically included in volley project when you clone(or download) it from AOSP repository. Here is the content of .gitignore you originally face to:
bin
gen
.gradle
build
.settings
target
*.iml
.idea
local.properties
As you can see in the volley repository, there are no files or folders listed above. Therefore, you have not included none of the items in your project except src folder that you have compiled it in your project. So, don't worry. Nothing wrong would happen with it.
.gitignore is created automatically when you create a repo for a project. You should put inside it the path to files that you don't want to be uploaded to git, basically files that must be ignored like a database file.

How to include external libs in Android source controlled project?

How should external libraries be included into Android projects?
I see this documentation from Google:
http://developer.android.com/tools/support-library/setup.html#libs-with-res
...which says they should be kept outside the source tree for the project, and referenced as dependencies.
The guide for Facebook libraries says the same thing:
https://developers.facebook.com/docs/android/getting-started/facebook-sdk-for-android/
What about when the project is going into source control, and will be worked on by multiple developers? Is it possible to be sure other developers will have the correct versions of libraries if they're not included in source control?
It seems as though it might be better to check in the whole tree of these external libraries under say an "external" folder in the project and then reference them as libraries from there? The above links don't say this is wrong, but is there any reason not to do that?
I could not find anything against this approach, but maybe my search skills are off.
Thanks!
You have basically tree options (referring to git):
Putting the source or binaries into your git repository.
You can create/clone extra repositories and link these as submodule into your main repository.
Use gradle/android-studio to maintain remote binary dependencies.
In my opinion, option 3. is the best. It speeds up build time and reduces the date saved in your internal repository. Referencing most open source projects, googles libraries and even the Facebook API is just a one liner in your build.gradle file.
For internal libraries or anything not uploaded to some maven repository, you can create a local maven repository and link that.
And in the end, you have the option 2. to create a library submodule within git and gradle to handle it efficiently.
If you want to stick to eclipse + ant, try 2. first.
At least ant will work out of the box for building all things.
Setting up eclipse is a bit more difficult but can be done.
Option 1. is easy to implement, but It might get messy at some point.
Copy jar file in android project libs forlder and right click on jar file and click on bulid path-> add to build path.
If you want to add jar file then copy your jar file and put in to libs folder, and if you want to add external library then import your library project go to project properties and select android tab and add external library with add button.

Debugging external libs in Android

I have several .jar files I want to reference into my Android project, and I have the sources for them. The point is that in order to build .jar's from sources, I have to use Maven - the build process is pretty complicated, and as I am new to both Android and Maven, I am trying to reuse the script for building these libraries that was written before me, and do not add the sources directly.
So my intentions were pretty simple:
Build the .class files via Maven script
Compile .jar from these .class files via jar tool in the command line
Reference these libraries from my android project.
But as soon as I copy .jar files to the libs folder in the android project - I cannot add sources on them - and I cannot debug those.
Looks like this issue has been several times on SO here or here. Still nothing works for me. .properties file doesn't seem to be recognized by Eclipse, when I go to Java Build Path - the path to the sources is marked as (None) and it is not modifiable, and if I reference the libraries like it was before ADT17 (adding a custom directory like lib with no s in the end, and referencing these jars as external libraries) - this fixes the debugging, but the compiler doesn't seem to include all the source code due to this
I've read that should be fixed in ADT20, but I am using ADT21 and still no luck. Any usable workaround of this?
Finally did it! That still looks like a bug in ADT. The only solution I found is to reference the libs as it was before ADT17 (put them into the separate lib folder without 's', add them to build path, and mark the checkboxes in the Configure Build Path -> Order and Export).
The thing I was missing is actually marking the checkboxes - for some reason when you change anything in that dialog, the checkboxes are becoming unmarked. I guess I just didn't notice that...

How do I attach a local javadoc folder to a project without an absolute path

I am trying to attach the source for android-support-v4 and have followed the instructions from this question:
How to install javadoc for Android Compatibility Package?
This project is shared on a git repo, so I don't want to checkin a .classpath pointing to a local folder.
What is the best way to point to this javadoc on a shared project? I am open to having everyone else generate the javadoc, but I need a way to point to each person's Android SDK directory. A solution that can checked into the repository would be better though.
Is there a variable I can use in the file path pointing to the javadoc folder? I am hoping for something like this: file:/$ANDROID_SDK_DIR$/extras/android/compatibility/v4/docs/
EDIT:
I found a comment on the bug that pertains to an issue with javadocs and android libraries. I created the properties file and I can now see the javadocs in Eclipse, but I still have the same issue. The file contains an absolute path to my own Android SDK directory.
I have figured out that in the new versions of ADT, you have to include a .properties file along with your jar in the libs folder. The normal way of changing the .classpath to point to docs/sources does not work in Eclipse with ADT, but this will.
If you have GSON in a file gson-2.2.2.jar create gson-2.2.2.jar.properties in the same folder
gson-2.2.2.jar.properties:
src=docs\\gson-2.2.2-sources.jar
doc=docs\\gson-2.2.2-javadoc.jar
Then create a docs folder inside libs and move your sources and javadoc jars into it.
This solves the issue where anything in /libs is compiled into your project. Only files in the root are included, so creating a folder for your docs (/libs/docs) is a great way to handle this.
As seen in this solution, he has a third-party library in a SVN repository and he wants to associate source/javadoc with it locally in Eclipse.
I don't think there is a satisfying solution but you can try.
Check this solution,
hope it helps you.

Categories

Resources