So I want to view PDFs in my app and I've come across APV PDF, but I just can't understand the instructions on how to use it
http://code.google.com/p/apv/wiki/Building
Why isn't it a jar library to download?
Why do I have to compile some .so files, why can't I download them?
I browsed the source and there is a demo application here:
http://code.google.com/p/apv/source/browse/#hg%2Fpdfview
I copied that into eclipse as an Android project and it compiles but I get an error when I run and select a PDF in the compiled app
java.lang.UnsatisfiedLinkError: parseFile
I understand this has something to do with what I've asked above, so hopefully I'll get some answers.
This probably has something to do with the NDK which I have no experience with.
My mind has been expanded!
1) You can't have a Jar as this is C code, so it is going to run in the NDK therefore the equivalent is a .so file.
2) I don't know why they don't let you just download an .so file (as well as having the source), but it seems this project is just a starter project i.e. you are expected to take the source and modify it. Therefore if you just had a .so file you could not do this. Each time you change the source code in /jni/pdfview2 you have to rerun the script build-native.sh and that will recreate your library (.so) files for you!
I was getting the UnsatisfiedLinkError as the .so library I was using was built against a different version of the code than that which the Java file was trying to reference. Therefore my link was un-satisfied!
Hazar!
Related
I'm an economist and data scientist trying to get into "formal" coding. For that I started taking the Princeton's Intro to CS from Coursera, thaught in Java. I had set up VS to write the code and everything went fine until the current chapter, which requires using libraries.
By creating a project and setting my .java there I copied the stdlib.lib library into the "lib" folder of my project I'm able to run the file from the Visual Studio. However, when I try to run the .java using javac Triangle.java from the console this is the output:
Can't find StDdraw library
Please note that on the left the stdlib library that contains the StDdraw class is loaded.
I am trying to build a small personal project with opencv. I included the path to the opencv jar file in visual studio using the java dependencies then referenced libraries but i get the linker error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java430 in java.library.path. I have no idea what else i could do
UnsatisfiedLinkError isn't about jar files.
It's about 'native' files. These are generally stored as a .jnilib file on mac, as a .DLL on windows, and as a .so file on on most unixen.
They cannot be in jar files.
Some libraries will put in some effort and ship a whole bevy of them (as each architecture and OS has a unique dll/jnilib/so file that is needed) inside the jar, will find the 'right' one for your arch/os combo, unpack it someplace, and try to load it live.
This is either not working, or this library isn't doing that. Presumably the opencv site contains a tutorial on how to get it running; as native files are required, it's a bit more involved than 'just download, add to classpath, and voila'. I suggest you follow it precisely.
If you do have something that seems suitable (probably called opencv_java430.dll or whatnot), start java with java -Djava.library.path=/directory/containing/that/file the.rest.of.your.java.args - that should help.
i started to learn android program ,and i curious to see the code of the classes/
for example the class of import android.app.Activity.
how can i see the source code of the packages in eclipse?
You can attach source code to libraries. yourProject / Properties / Java Build Path / Libraries / yourLibrary / Source attachment, and then enter the folder or zip file containing the source code (which you need to download separately).
If you only have the object code (.class files), then you need to learn to read ByteCode (which Eclipse shows pretty nicely) or use a Java ByteCode disassembler.
As in android sdk what we get is a compiled jar file which contains all the classes.
So in eclipse you can't read the source, but you may use, The official online version to read the source code of classes:
http://developer.android.com/reference/packages.html
[In eclipse although by CTRL+Click on import may show you a bit about the class, although that won't be easy to understand :)]
I'm working on a java android project. this project requires to use specific commands.
these commands are all developed in c++/c but I've been given two files (.jar and .so) that are supposed to "turn them into" java, so I can use them in my java android project.
The thing is, what am I supposed to do with these 2 files?? I've read a lot of stuff (mostly about creating the .jar and .so, but I don't care about this step, for I already have the 2 files)
I tried to import the .jar (import external lib), I tried to add the .so via the static loading :
//static {
// System.loadLibrary("MySoFile");
// }
All I get is a stack overflow error or a problem with the DEX file...
Has anybody ever tried to do this??
I don't seem to get the point here...all I want to do is being able to use the commands in the .jar file.... ://
thanks in advance!!
Take a look at this answer about adding jar files. '.so' files can usually just be drag and dropped to the project.
All you need to do is make sure the jar is in your classpath and you can then access the classes within this jar. A jar is just an archive of classes, you don't need to load the library into memory or something similar.
You may want to read the answer to the question here How to use classes from .jar files?
How to convert .apk files to java in android.
The extension Google uses for Android Applications (APK) may seem a bit complicated at first, but it really isn’t. In fact, an .apk is nothing else than a .zip file disguised as an .apk. That’s dumbing it down, but you get it. Essentially, if one wanted to see what’s inside an app, they would just change the extension of application-name.apk to application-name.zip, unzip it. And there you have it: The contents of the .apk! We aren’t done yet, read more after the break.
Here is where it gets tricky. Inside the folder where you unzipped the contents of the application, you’ll find a file named classes.dex. That’s the most important file of the whole application, containing all the java files, but it’s encrypted! No worries, that can easily be solved. You’ll need two things:
Dex2Jar from http://code.google.com/p/dex2jar/
A regular Java decompiler, such as JD from http://java.decompiler.free.fr
Copy classes.dex to the folder where you unzipped Dex2Jar, and run from the command line: “dex2jar.bat classes.dex”
This will produce a file, strangely named something like: “classes.dex.dex2jar.jar” If you have WinRAR installed, you can just unpack the files. If you don’t, install it.
Now go ahead and adjust it to your liking!
its easy just follow the below 4 steps :
1) Unzip your .apk to the folder and get the classes.dex file.
2)Place this classes.dex file inside dex2jar(you should download this) and execute ./dex2jar.sh classes.dex in the terminal.
3)It will create classes.dex.dex2jar.jar,place it inside jd-gui(you should download this).
4)Execute ./jd-gui classes.dex.dex2jar.jar---will generate the .java files.
You can't just convert a jar to an apk. It has to be compiled for android. Android's java library doesn't have all the swing stuff that's in normal java, so the app most likely would have to be re-written to work on android
Pretty sure MIDlets (MIDP jars) don't use Swing or awt. They have a separate user interface api under javax.microedition.lcdui (http://java.sun.com/javame/reference/apis/jsr037/javax/microedition/lcdui/package-summary.html)
As for converting MIDP programs to runnable APKs, there is certainly a way. Technically it isn't a conversion but the use of a wrapper around the unconverted MIDlet. This is the approach that Opera Mini for Android uses. More info:
http://edugoing.com/qna/index.php?qa=unanswered&start=40