I have a relatively simple question:
Is there a possibility to run an xslt-script on an android device? I have an .xml file, using a .xsl script to create a new .xml file.
On windows I am using saxon, which works good, but as I don´t have always access to it I would prefer to run a script on my android phone and/or android tablet.
I did some research with google and also on this site, but i didn´t found any clear answer.
thanks in advance and greetings
I have now found a way to run both Saxon-JS 2 or rather its command line tool xslt3 as well as Saxon HE Java from a command line terminal for Android.
I installed Termux, I had to use the version from F-Droid, as the one on the Google play store seems to be no longer supported, then in the Termux terminal shell I installed node and java (try to run with e.g. ˋnodeˋ and it will tell you the ˋpkg install ...ˋ command line to install, then I did e.g. ˋnpm install -g xslt3ˋ to install Saxon-JS's command line tool and downloaded the Saxon HE 11.2 Java zip from Sourceforge with wget and unzipped it and finally I am able to run e.g. xslt3 to run Saxon-JS or java -jar path-to-saxon11jar to run XSLT 3 (or in the case of Saxon Java of course XQuery too.
The interaction with the rest of the Android file system is a bit complicated to find out but the Linux Terminal shell has its own file system with a storage folder with sub folders like storage/download linked to the usual download folder other Android apps (e.g. your browser) use.
Here is a screenshot of Termux on my Android tablet showing the execution of Saxon HE 11 Java and Saxon-JS 2: .
It turns out the same procedure doesn't work quite as well on my Android phone which has Android 12 as the running Java and therefore Saxon HE 11 or any other Saxon Java HE currently does not work due to a known issue https://github.com/termux/termux-packages/issues/7332. But Node.js and npm and therefore Saxon-JS with xslt3 run fine on that phone.
Related
I'm trying to run a simple hello world app as a start of python in android,im an intermediate in python,never tried python in android but i want to run it in my phone, but i've tried, researched, i've installed kivy, and all its requirements in its original website, my main error is down below, im on windows 10, and i try this apt,sudo and dpkg thing none of them are recognized as an internal or external command(i do these in command prompt, should i not?),i have the buildozer.spec file in lib but couldnt find a way to edit, i've also tried other ways im really stuck here, my android version is 5.0.1 if that helps, please help im stuck.
C:\Program Files\Python37\Lib>buildozer android debug deploy run
I Check configuration tokens
[91m[1mBuildozer is running as root![0m
[91mThis is [1mnot[0m [91mrecommended, and may lead to problems
later.[0m
Are you sure you want to continue [y/n]? y
Unknown command/target android_old
You should download the kivy virtual machine at https://kivy.org/#download (It's at the bottom). Import the machine into virtualbox. If you don't have virtualbox installed, you can download it at https://www.virtualbox.org/wiki/Downloads. Get your application files into the virtual machine, and run buildozer init in your project directory. Edit the buildozer.spec file, and run buildozer -v android debug.
Worked for me. Hopes this helps. :)
i'm currently reading through head first python and upon reaching chapter 8 I got stuck. The book wants me to download SL4A from the link http://code.google.com/p.android-scripting however that link no longer works. So I did some searching and found the file on github. My real problem is when I try to download it on the emulated device it just says waiting for data connection and it never downloads. I am wondering if there is a way to fix this. Any help is appreciated thanks!
EDIT: to get it to work I downloaded both files from here https://github.com/kuri65536/python-for-android/blob/master/README.md
then I copied the files to the folder
C:\Users\lucas\android-sdks\platform-tools
then I opened CMD and cd to the path above.
then use the command:
adb install (filepath)
for both files and they appeared on the emulated device.
Download to your pc and push through ADB.
Download files and adb install worked for me in my installation (Windows 10, android studio 2.1.1) with minor differences:
1) adb command is located in:
C:\Users\MyUser\AppData\Local\Android\Mysdk\platform-tools
Need to add to path
2) Needed release sl4a-r6.1.1-x86-debug.apk. Downloaded it from release pages
I'm also reading through HeadFirstPython and got stuck at this stage (with the error: app not installed). I tried the abs method above and ended up with yet another problem: install_failed_no_matching_abis. After a lot of research, I got to understand that the "native libraries" of the sl4a.apk were not matching the system architecture of my emulated android. In other words, if one wants a faster emulator in android studio, he ought to use an x86 architecture android; but the problem with that is scripting layer for android is programmed to work on ARM architectures hence the 'install_failed_no_matching_abis' error.
The solution that worked for me was to go back to AVD in Android Studio, delete the downloaded emulator (which was of x80 cpu/abi) and download one with armeabiv7 cpu, recommended level=24. It took a lot of trial and error to get to this choice as other android cpu/abi were either too slow or just wouldn't allow me to install the required apps.
Edited: In the end, I was directed to use GenyMotion as that performed better in terms of speed. I was reluctant at first but, to my surprise that really is the case (It is super faster than ARM android studio alternative). Not only is it a great emulator, it also has this ARM translation tools that allows one to easily install ARM sl4a.apk on the x86 devices.
I'm building my apk using Buildozer in Ubuntu. But I am more comfortable using BlueStacks in Windows for the testing purpose. My app crashes after it starts with no apparent signals. How can I debug it using BlueStacks?
There's a debug tool with file name: HD-Adb.exe in Program Files (Program Files (x86) in Win64) path of BlueStacks. When you run this tool, you could see all what happens behind the android emulator. It's easy to debug your app then. To run the tool open command line in Windows and type the following lines:
> cd "c:\Program Files (x86)\BlueStacks"
c:\Program Files (x86)\BlueStacks>HD-Adb.exe logcat
I really had hard time trying android sdk emulator and other things. But this works great! Enjoy debugging.
When I enter this in the Windows CMD...
red -c -t Android hello.red
...Red outputs a file called hello with no filename extension. If I transfer this file to my Android device, it doesn't know what to do with it.
What additional steps must I follow to test my Red code on my Android device?
Which of those steps, if any, must I do differently, depending on whether or not my code will attempt to use the Android bridge?
The Android port is a work in progress done in the android branch. In that branch, using:
red -t Android <script.red>
will use the APK backend for the new packaging layer that will handle the whole process of APK generation for you (provided that you have a JDK1.6+ pre-installed). If all went well, you will get an APK in your working folder.
In case you need to debug the building process, you need to edit the system/formats/APK.r file and set on line 11 the verbose word to yes.
Note: We are working on removing all the external dependencies one by one.
EDIT: The Android Red port has been moved to a private branch and actively worked on. It will be made public once beta stage is reached.
Unless you package up the executable into an .APK, then for security reasons Android throws up some walls in your path to chmod +x it and run.
I followed these directions, just with:
$ cd /data/data/jackpal.androidterm/shared_prefs
$ cat /sdcard/Download/hello.bin > hello
$ chmod 755 ./hello
$ ./hello
Without rooting or otherwise, you wind up with that weirdness like using cat instead of cp, and slipping the file into a strange directory where execution is allowed.
Tested on Nexus 5.
I've not tried yet, but check this: http://www.red-lang.org/2011/12/arm-support-released.html
Also you may know, that there is an experimental Android version here: https://github.com/red/red/tree/android
It appears the question has been answered, but for those who want more, there is an article for getting started with Red for Linux and Android in the March 2014 issue of ODROID Magazine at http://magazine.odroid.com .
There is also going to be a short how-to article in the July 2014 edition (released in the next few days) by Gregory Pecheret that will demonstrate building an .apk from scratch in Red.
So I asked and answered the question [how to do Phonegap 3.0 without Phonegap Build][1]. Now my app is ready for iOS as well (I think) and it's time to start deploying and debugging for that platform.
The formal question: how can I add the iOS platform to a Phonegap 3.0 project?
This answer is still in progress.
Goals I've achieved:
Compiling the project in command line, then running on device or sim using xCode
Attempts failed:
Compiling and running (device/sim) all from the command-line
1. Creation
I could easily add the iOS platform as described in the docs' iOS Platform Guide.
Basically, if the project already exists because you did Android first, this is how you set up the iOS app structure.
$ add platform ios
Then you should add files to the main /www folder if you didn't already have them from your Android work. Then this takes care of creating the app in debug form:
$ cordova prepare //Creates all the necessary source filed
$ cordova compile //Creates an ipa file
//Alternatively, do both in one go with cordova build
2. Deploying to device
But it is completely unclear how to use the command line interface to actually deploy the test app to device or emulator.
When you attach a physical iOS device, and simply try this from the main project folder...
$ cordova run ios
You get a pretty clear answer:
[Error: An error occurred while running the ios project. Targeting a device is not supported currently.
]
So I've resigned myself that for device testing, I must still use xCode. No biggie. However, xCode cannot "refresh" the project by itself after you've updated your files, so in between deploys you must go back to the command-line to recompile the iOS app.
Strangely, when I update my code, I do need to use "cordova run ios" (even with the above error) in order for the the /platforms/ios/www folder to be updated. So this is what works and does not work:
$ cordova run ios
//Rebuilds the app with main /www files successfully,
//then tries to deploy to device and fails in that.
$ cordova prepare ios
//Does not rebuild with main /www files
//(Also does not deploy but that is not its intended function)
And remember that you also need to clean your xCode project in between runs. So the sequence is:
Previous run
Edit your code
In console, do: cordova run ios
In xCode, Menu bar > Product > Clean product
in xCode, Run
3. Deploying to emulator
Still, "deploying to device is not possible" begs the question "What about emulator?"...
The docs page on the 3.0 command-line interface mentions you should enter the command
$ /path/to/my_new_project/cordova/run
This had me all confused. What kind of path is that? From where are you supposed to run it? Is it a nice way of providing a command you can run from anywhere? Why force me to enter my annoyingly long project path for each command?
Confusingly, the run command doesn't work if you actually go to the "platforms/ios/cordova" directory where the run executable is located.
The trick is to be one directory lower, i.e. at the /platforms/ios subfolder of your Cordova app project. There you type "cordova/run". Then in my case it starts building.
4. Install "ios-sim"
But that was not the end of it. I subsequently get an unanticipated error about "ios-sim" not being installed.
[...]
** BUILD SUCCEEDED **
Error: ios-sim was not found. Please download, build and install version 1.5 or greater from https://github.com/phonegap/ios-sim into your path. Or 'brew install ios-sim' using homebrew: http://mxcl.github.com/homebrew/
Fortunately that project webpage has adequate documentation on how to install. However, even after adding the ios-sim directory to my $PATH, when I want to emulate I get the following error.
$ cordova emulate ios
[TypeError: Arguments to path.join must be strings]
This is where I am currently stuck. My path looks exactly like this (all in one line):
export PATH=${PATH}:/Applications/adt-bundle/
sdk/platform-tools:/Applications/adt-bundle/sdk
/tools:%JAVA_HOME%\bin%ANT_HOME%\bin:"/Users/
cool/Library/Developer/iossim"
What am I doing wrong? I've tried with and without doublequotes, and I've even renamed the ios-sim directory to iossim in case the hyphen was the problem. No effect.
So no simulator for now.
5. Install to iOS App Store
This is the point where Phonegap really leaves you out in the woods. Maybe because they want you to use their paid app publishing service, but also because the process of publishing an iOS app is basically soemthing you do using xCode, iOS Developer Portal, and iTunes Connect.
So here that goes:
You need to have all the right certificates and profiles for your app (yes, it's a bunch of incomprehensible virtual documents that all require each other, Apple is like the Soviet Union of app stores).
You request those certificates and profiles in the iOS Developer Portal, save them to disk, then double-click them so that xCode knows you have them and will include them in your app.
This is the docs page for xCode 4 on how to publish your app.
The most counter-intuitive bit is that in order to publish your app, you first have to create an archive of it in xCode (Open your project in xCode > menu bar > Product > Archive).
When the archive is made, you will see it in the Organizer view under the Archives tab. There should be two buttons: Validate and Distribute. Validate checks and includes all your profiles and certificates in the app, and it also checks for errors like a wrong version number.
Distribute does what it says: it sumbits the app to the App Store.
Congratulations! (Now wait five days)