I am trying to validate an xml file against an xsd schema file using Xerces. I am hitting errors that I am unable to resolve, below is the logcat output. Please note that trying the same code and xercesImpl.jar file in a java application produces accurate validation results but moving the same to android results in errors. Please advice.
E/AndroidRuntime(792): java.lang.NoClassDefFoundError: org.apache.xerces.parsers.SAXParser
Thanks..
The solution is to use Apache Xerces ported to Android.
There is a project here
You have to do a svn chekout and export the proyect to a jar file to use as a library in your android proyect.
The code to instance SchemaFactory change a little.
I show you an example:
import mf.javax.xml.validation.Schema;
import mf.javax.xml.validation.SchemaFactory;
import mf.javax.xml.validation.Validator;
import mf.org.apache.xerces.jaxp.validation.XMLSchemaFactory;
SchemaFactory factory = new XMLSchemaFactory();
Schema esquema = factory.newSchema(".../file.xsd");
The problem is that android doesn't have xerces and validating interface =)
But you can simply add validating from xerce:
You can use xerces and native schema validation (in java) in adnroid - you have to download xerces sources and (after some simple manipulations) include it to your own code - you will be able to use DocumentBuilderFactory.setShema method.
https://stackoverflow.com/questions/13142567/xml-schema-validation-xmlsignature-with-xerces-in-android
Related
I have an Android native library (C++ code base) called:
libserverapp.so
And I cannot get the Android build to find it:
"DllNotFoundException: serverapp"
I am using an internal build system, but when I parse the output of the build process, I can see many calls of the form:
android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-g++.exe -march=armv7-a
After building my Android app, I inspect the resulting APK (renaming to .zip and extracting), and can see my library file here:
lib/armeabi-v7a/libserverapp.so
I can confirm that "ARMv7" is the target architecture in the Android Player settings, and I access the library, in C#, via:
[DllImport("serverapp", CallingConvention = CallingConvention.Cdecl)]
private static extern void run_sim(StringBuilder matchInput, StringBuilder results, int randomSeed);
I have built a Windows DLL of the C++ code, to use in the Editor, and everything works great. However, when I move to Android, the .so cannot be found. The import settings for libserverapp.so are:
Platform: Android; CPU: ARMv7; Path: Assets/Plugins/Android/libserverapp.so; Type: Native
Given that the final APK includes the .so where I expect it to be (lib/armeabi-v7a/), I assume my Unity settings are correct? Also, I am not using IL2CPP for the Android build.
Finally, when I do an object dump of the library file (using arm-linux-androideabi-objdump.exe), the file format of the library file is "elf32-littlearm".
I feel that the issue here is simply finding the .so, not the functionality within it. Any ideas on what's going on here?
Thanks!
I ended up solving the problem. I mentioned that was using an internal build system. Well, there seems to be a bug in it. I ported things over to official Android NDK makefiles, and then it "just worked". So in this case, the library could be found, but its contents weren't valid.
I'm developing a game that stores data on server in cocos2d-x 3.2 in eclipse c++ for android.
In .h file I include network file #include "network/HttpClient.h".
In .cpp file I wrote following code.
HttpRequest *request = new network::HttpRequest();
request->setUrl("My Url");
request->setResponseCallback(CC_CALLBACK_2(HelloWorld::onHttpRequestCompleted, this));
cocos2d::network::HttpClient::getInstance()->send(request);
But on cocos2d::network::HttpClient::getInstance()->send(request); generate undefined reference to 'cocos2d::network::HttpClient::send(cocos2d::network::HttpRequest*)' this error.
I search it on cocos forum too but i don't get solution of my error.
Thanx in advance.
Not sure if you're still interested in this but all you need to do is add the libnetwork.tbd to your project. For me I used XCode so I just goto Target and then to the Build Phases and add libnetwork.tbd in the "Link Binary with Libraries" section. Then I am able to import "network/HttpClient.h" and using namespace cocos2d::network.
is there someone who has experience with pyqtdeploy and adding external modules? I am currently using pyqtdeploy (version 1.2) together with PyQt 5.5.1 to write an application that can be deployed to an Android device. Without any external modules, the freezing with pyqtdeploy works pretty well. However, I am not really sure how I can add external modules (not pure Python ones) to my application.
In particular, I want to add the external module pycrypto. Therefore, I downloaded the pycrypto sourcecode, compiled it with the Android toolchain (from the Android NDK) and now I have a bunch of *.py and *.so files. How can I add them to my application?
My initial attempt was to add the *.py and the *.so files (so basically the whole pycrypto module) to the "Other Packages" tab in pyqtdeploy.
But now, when I import something pycrypto related in my application (from Crypto.Cipher import AES) i get the following error message:
File: ":/Crypto/Cipher/_AES.py", line 20 in __bootstrap__
TypeError: 'NoneType' object is not callable
The _AES.py file where the error is thrown, looks like this:
def __bootstrap__():
global __bootstrap__, __loader__, __file__
import sys, pkgutil, imp
__file__ = pkgutil.get_data(__name__,'_AES.cpython-34m.so')
__loader__ = None; del __bootstrap__, __loader__
imp.load_dynamic(__name__,__file__)
__bootstrap__()
At first I thought, that the *.so filename was just wrong and therefore, I got the NoneType Error, so I changed the filename in _AES.py to something other like 'test.so'. Surprisingly, now, I get a different error message than before:
File ":/pkgutil.py" line 629, in get_data
ImportError: qrcimporter: error opening file :/Crypto/Cipher/test.so
Ok, so the filename should be fine, right? But why do i get the 'NoneType` error message? What am I doing wrong? Is this the right way to accomplish this?
Any help is highly appreciated. I am pretty sure, that i'm only one small step away from getting this thing to work, but I can't figure out what i'm doing wrong.
Thanks!
Python for Android supports lxml. But how can I import it? On the google site, there is a modul in a recipe.sh file. But i can not run it through the shell there. I get some errors:
app_122#android:/mnt/sdcard $ sh recipe.sh
: nor found]
recipe.sh[6]: get_directory: not found
: not found]
recipe.sh[9]: syntax error: '{^M' expected
1 app_122#android:/mnt/sdcard
Can't I just get some .py file and simply import it into my programms?
I used this code:
https://github.com/kivy/python-for-android/blob/master/recipes/lxml/recipe.sh
Can someone help?
I think you might be confusing py4a which is a sister project of SL4A (Scripting Layer For Android) with https://github.com/kivy/python-for-android which is a sister project of Kivy
Both are different projects with different targets. You should be clear about which project you want to use. Read the docs to get more familiar.
kivy/python-for-android docs
Discussion groups
py4a docs
Discussion groups
I am trying to create an android application to connect to Azure's SQL database. When I try to create a ODataConsumer object that would later be used to filter the message.
The ODataConsumer object is create with the create method
ODataConsumer c = ODataConsumer.create("http:/xxx/yyy.svc");
But when the execution reaches here, I get class def not found exception and the application is force closed.
I downloaded the jar files from the following site
http://code.google.com/p/odata4j/downloads/list
I started off with v0.3 as this is the jar file used in the demo that is provided by Microsoft. I also tried v0.4
I add <uses-permission android:name="android.permission.INTERNET"/> to the manifest file of the project. I also import
import org.odata4j.consumer.ODataConsumer;
import org.odata4j.core.OEntity;.
Am I missing something here?
The error that I get is AndroidRuntime(595): java.lang.NoClassDefFoundError: org.data4j.consumer.OdataConsumer
You should really be using the latest version.
Also the class name in the error is misspelled. It's ODataConsumer not OdataConsumer.
I was having the same problem. In my case I was able to follow the example here:
http://xrigau.wordpress.com/2012/03/22/fix-some-problems-with-libraries-in-the-adt-17-plugin-10/
which is described here:
Android-SDK r17 ruins working projects
which solved my problem. Good luck.