Is it possible to use window lib on Android - java

Here is my case, I have a window library + headers, but no source code. I want to use this lib on an android tablet. To make the porting effort minimal, I am thinking about three possibilities.
Android app + windows library.
But is this even possible?
java lib + windows lib + android app
I am not sure if I am correct. but I heard pure java app is not supported on Android. What I am planning is to make a java lib which links to that windows lib, then make a jar to include them, finally make a separate Android app using this jar.
Qt app + windows lib on android app
It is possible to run qt app on android. So if I create a standalone Qt App including that windows lib first. Run this Qt App on android device?
Please shed some light! Many thanks!
Br,
Tao

The short answer is "no, you cannot". Windows library (I assume it's a .dll or a .lib) is compiled on windows, with windows OS architecture in mind. That code would not be usable or even parseable on any other platform. It's like saying, "I have this wheel from my Mack truck, and I want to put it on my Mercedes C-class. How can I do it?"
If you don't have the source code for the lib, the you're out of luck. Moreover, even if you did, most likely it used some specific windows API that are not available on Android or any other OS, so you'd end up rewriting it anyway. As you have the header file, you are already part-way there, as you don't need to re-invent the interface.

Related

Running JAR on iPad/iPhone

I have a JAR (java application), which I want to run on my iPad. Is that possible, How to do this? If possible through Appstore, (I know the process of Appstore and I have Apple Appstore account), please let me know is it possible to upload jar in Appstore and download from there?
No, it's not possible to run jar file into iOS or upload to App store. but Oracle ADF Mobile uses a native container that runs applications on both iOS and Android from a single source base. One part of that native container is a headless/lightweight JVM, but it's definitely not a .jar file
http://java.dzone.com/articles/oracle-gets-java-running-ios
http://www.infoworld.com/t/java-programming/java-ios-just-keeps-getting-easier-204543
That's impossible. Apple doesn't support Java. Apple uses Objective-C as its main language. If I'm not mistaken, Safari on iOS doesn't support Java too so you can't run applet on iOS too.

How to run Java app in Android

Is it possible to run java app (jar) in my android application? Because I need to create PDF, the problem is if I generate PDF in android, only can show with small image, if it contains large image in many pages, it will be error. So I think, I can generate PDF in java and then included to android app.
Concernig the mentiones app JBED:
Well honestly, I could not find any credible source for this tools JBED, so I would really be very cautious (e.g. who is the developer?)
In the manifestfile (in Androidmanifest.xml, where every app has to state what rights it needs to run, see How to view AndroidManifest.xml from APK file?) there are many rights mentioned (what could be necessary, as the app wants to run as an emulator), so a java application might want to send an SMS, record audio, take pictures and place calls -- so the emulator would need those rights as well.
But then the app also registers the "android.intent.action.BOOT_COMPLETED" event (i.e. autostart after boot) and this would go against every description of the tool.
Ah yeah and giveaway: The apk has a folder "certs" that has some (root-)certificates. But those are not the real certificates of the authorities, e.g. Versign. If one installs the app and by that those certificates the trust you might have in https-connections is lost because those who made the fake certificates can create own, false certificates that your phone would trust.
I assume (or am pretty sure) this is a spy tool, but I could be wrong. The (rare) testimonials that claim the tool ran perfectly will probably be the same person that posted the tool under a different name.
Andreas
You can import java Third-party libraries into Android app, follow the steps here.
I am not sure whether it will work,but just try.
If your program is a console program, the answer is yes.
Install Jvdroid from Google play. Click terminal and then write this command: java -jar YourJarFileName.jar
The simplest way would be to some install terminal emulator and then install java and then you can run java apps on standard java. You can even install full Linux distro with x server without rooting the phone, then connect to it from x client and you have Linux desktop on android. Once I've even installed eclipse for java development on it and everything worked. I tested this setup last time in 2014, but I'm pretty sure you can do this nowadays as well. The app with Linux I get from play store as well app for the x client. The app I used back then was "Debian no ROOT" or smthg like this. You need to check what's currently available to make this setup in Google Play store according to your android version and your preferences. Last time I've checked there was a lot of different tools for this kind of task. Lastly I've even successfully installed TF and keras on my android phone using terminal emulator.
You can use JBED. JBED is an .apk Android application which run java games and app on your android Device. JBED is a java android emulator, by using
this application we can install .JAR/.JAD/Java/J2ME/MIDP app on android phones.
You can do it quite easily as there are many ways to run java apps on android. Specific application called Java Emulators can do it quite easily.
These are four most popular java emulators for android viz, JBED, PhoneME, Jblend and NetMite. These are arranged in order of their preference. You can use phoneme for non rooted device, however if your device is rooted try any of the remaining three applications.

Build Android native library with Adobe Air

I'm currently working on an Android application built with Adobe Air sdk, in AS3. I was wondering if it's possible to compile a kind of UI library that I can import in a Android native application (Java). Basically, I would like to build my UI with Adobe Air, but the main part of my application with Java, the native way.
What I have in mind is to convert the adobe air-generated APK into a Jar file I would import in the native application project, and call some functions that display something on the Screen.
Is it possible? I think it may be possible, because when I don't import Adobe Air SDK in the application, I must install Adobe Air application with the Play Store to make my application working. I don't find lot of things on Google about that :s.
Thank you for your help.
Yes it can be done (in theory), but hold on to your hat, it's a bumpy ride!
I see it is a very old question, with a new bounty (the questioner has not logged on for 3 years!), but here we go...
This method goes to the heart of how android java apps are constructed and run (i.e. DEX, so it will work with adobe-air or ANYTHING, it is fundamental [general method]). (by the way you use the word native in a confusing way, native is commonly understood to mean the JNI (c++) library element of an app).
You say:
"What I have in mind is to convert the adobe air-generated APK into a
Jar file I would import in the native application project, and call
some functions that display something on the Screen."
Android programs are compiled into .dex (Dalvik Executable)[now called ART but binary compatible] files,
which are in turn zipped into a single .apk file on the device (with other things like the manifest and resources). (unzip a .apk and look inside).
A .jar file contains DEX files (zipped). (unzip a compiled .jar and look inside).
I have done some work like this before, here's a link to a tutorial and coding examples [tested by me] (in android studio + gradle) [custom build elements are usually needed (I also give an ant example)].
See my stack-overflow answer Dynamic loading of DEX files
This in theory answers your question, but it's fundamental stuff, complex and has limitations that make it hard to code and maintain (resources are a real pain in the a**e).
Question: This all seems very complicated and hard !
Yes it is ! It is an increadably silly an difficult thing to do! That is why we invented cross platform frameworks, (and for web based code javascript/css/html5...). Failing that PORT the code.
I'm more of a Flash/AS3 coder than Java so can't give you a full answer but...
A better approach might be to just render your SWF-based User Interface itself via Java code (as opposed to compiling SWF into APK format then trying to embed Flash APK inside Android APK).
This way your SWF can also communicate with Java functions (via AS3's external Interface class). Making it easier to trigger Java functions when a button on the SWF U.I is pressed etc..
You just have to find an SWF render library for Java.
Maybe check out SWFTools. Particularly the SWF Class looks promising. I have not tested this library but it might help you.
I am not a Adobe AIR developer at all, however, I have developed a few Android App with both native environment and with some kind of framework (specifically PhoneGap). So, may this can help you.
I don't think that there would be any tool which could directly convert mobile apps build using frameworks like Adobe AIR, PhoneGap or any other HTML5 based framework to a native Android app because technically it is very difficult and unfeasible to do a proper mapping between each and every element of HTML5 (or Flex element in your case) to a corresponding native control or logic. The best you can do is use plugin mechanism provided by your framework to interact with Java and vice-versa and basically that is why the framework is there. For most of HTML5 based frameworks there is a plugin mechanism which allows developer to interact with native functionality (like Background Services, Activity or any other native resource). Even these frameworks are build using the same modular or plugin based approach and there major functionality (accessing Camera, Audio, SD Card etc native resources) works like this. We have to enable that feature before using that in our app.
So, look for plugin type of mechanism in Adobe AIR.
Hope this helps.
Maybe this is a dirty way to help you, but you can :
Install the adobe air program in one computer
Copy the files of the install folder of the adobe air program
Embed all this files in the java application
Install the java application
Save the adobe air files in one folder
Start the adobe air with java (like you will do it with the console, a simple call to YourAirApp.exe)

How do I integrate a java client with an android application

Ok just to give a background I have a WCF service and I've made a client for it in java using MyEclipse 10.0. Now basically the client needs to reside on an android device and it just struck me that I might not be able to port it. I have absolutely no experience (of course I've got the HelloWorld app running though) with working on android. Also what I had in mind was that I'd create an applet in java for the client but I'm presuming awt wont work in android. I've seen that the android toolkit for designing an app is quite good so I dont mind working with it. But all that is bothering me is how do I integrate the java client which includes a lot of imported class especially from the javax.xml package. Any suggestions on how I can move forward will be welcome. Thank you!
No worries. Android SDK is an extension of Java core SDK. So you can use any class from Java by importing the Libraries (Jar files) in Android Project. Unless the library is any hardware specific it will work well with Android too. (Not all, Most of them).
For example if you use an API to call a web service in Java, you can use the same in Android by adding that Library to your Application.

Using Android libs on a desktop Java VM (like OpenJDK or OracleJDK)

I have never tried out the Android SDK and do not own an Android phone. However it seems that certain libraries are excellent, for example the text to speech lib. Is it possible to use this library with a desktop VM and did anybody here try this?
You could get the sources from android.git.kernel.org and try to rebuild them against a desktop environment, but it would be a lengthy project - you need not only the java stuff, but the underlying drivers, native libraries, customized c library, and add-on os functionality to support them.
The android SDK includes a qemu-based phone emulator in which most functionality works as on the device. This should be fine for playing with the capabilities, though is not something you would want to use to deploy them. There is also an x86 community build of android which people put on netbooks or run in virtualbox. Word is that the official android emulator may be moving to something similar since it's substantially faster to run x86 code on a customized os image in a vm than to emulate an arm processor.
There's also something of a simulator which tries to provide enough of the android o/s services to sort of run apps natively on the development machine without a vm, but the google folks have implied its a bit of a hack and not well maintained.

Categories

Resources