Xerces in Android Studio - android

I'm trying to use spring-context in an Android project and have gotten as far as trying to load a context file. I'm getting this error:
Your JAXP provider ... does not support XML Schema. Are you running on Java 1.4 or below with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.
I've found partial answers from a couple years ago indicating the fix is to include Xerces in my project.
I'm using Android Studio, which forces me to use Gradle. I can't for the life of me figure out what to use as the classpath to include Xerces in Gradle. Does anyone know what it is? Is Xerces even available to Gradle? Is there some newer, easier fix that I've missed?

Was that the only thing you wanted? :)
'xerces:xercesImpl:2.11.0'

Xerces extends the core library javax.*. Extending core libraries is not allowed in Android. However you can use --core-library to suppress these warnings. However, this is not recommended. For more information see this.
You can overcome this problem by repackaging the needed classes with a tool like JarJar. This has been done in the Xerces-for-Android, wherein the package mf is placed above the "normal" Xerces packages.

Related

Do we need Jack to use Java 8 features to make a build using Android.mk?

I have an Android.mk file and I was trying to make a build for Android 8.1 where I was using RxJava but while building it, I was getting the error
Lambda coming from jar file need their interfaces on the classpath to be compiled
so, I searched a lot and found that
"ANDROID_COMPILE_WITH_JACK:=false"
fixes the issue but I want to know how and why it is like that.
I found on https://source.android.com/setup/build/jack that Jack supports Java programming language 1.7 and lambda(in rxJava) is 1.8 feature so is it causing the problem? That is why I need to disable the compilation?

How can you add external dependencies to bazel

I am a student and currently working on a project where I am trying to connect my game that which I have created with Android Studio. A neural network has also been made with Tensorflow which is going to be used for the android game.
The problem is that Android Studio uses a build tool which is called Gradle and Tensorflow uses Bazel. To solve this problem I have been trying to build my android game with Bazel but I am stuck at the part where I have to add the used external dependencies. For the game I use the following dependencies:
Appcompat
Support
Percent
Which supposedly should come with the android support repository.
I have looked at http://www.bazel.io/docs/external.html and several other sources but I still do not understand how I can add the dependensies. Could someone provide me with an example how to do it with for example appcompat and what I have to do to make it work? Or is there another way which would be easier?
EDIT: I have have been succesful in building the android example of Tensorflow but this: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android
But it doesn't include dependensies which I am using.
You may want to look at the Makefile support we just added for Android:
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefile
It's still very experimental (and fiddly), but should let you build a static library that you can more easily use in your gradle project.
Nevermind I resolved my issues, after removing the depensies I checked the WORKSPACE file. It seems I didn't set the package correctly, my bad.

Lint finds warnings in log4j used in Android project

I use log4j in Android project, dependency defined in project gradle like:
compile 'log4j:log4j:1.2.16'
When Lint check happens, the analyser reports "InvalidPackage" errors:
../../../../../../../.gradle/caches/modules-2/files-2.1/log4j/log4j/1.2.17/5af35056b4d257e4b64b9e8069c0746e8b08629f/log4j-1.2.17.jar: Invalid package reference in library; not included in Android: java.awt. Referenced from org.apache.log4j.chainsaw.ControlPanel.
../../../../../../../.gradle/caches/modules-2/files-2.1/log4j/log4j/1.2.17/5af35056b4d257e4b64b9e8069c0746e8b08629f/log4j-1.2.17.jar: Invalid package reference in library; not included in Android: java.awt.event. Referenced from org.apache.log4j.chainsaw.Main.1.
....
How can I fix that the better way?
Lint suggest to supress this warning by id, but this means supressing all warning by the type, am I right? This looks like not the best solution...
Maybe some way to specify lint not to check the log4j package?
awt itself is not supported in Android.
Instead use the native Android graphics as detailed in How to add java.awt.image package in Android and other questions like 25488832: using-awt-classes-in-android
Of course this doesn't help much if you rely on a library which relies on awt . Possibly there is an Android version of such library.
(You may be OK using parts of a library which provokes this error. You can only use parts of the library which do not use awt, else, RTE. For this, your build process would have to tolerate the reaction from Lint. There are likely safer ways around this. )

Scala library in build path doesn't expose its version (Android App Dev)

I am receiving the following error when I add android-scala.jar to the build path of my android application: The scala library found in the build path doesn't expose its version. Please replace the scala library with the scala container or a valid scala library jar. Does anyone have any idea what maybe causing this or a potential solution to this problem?? Let me know if more information is helpful; however, I cannot even get the emulator to launch with the current error.
Thanks,
Michael
The library needs to be called scala-library.jar, and it has to contain the original library.properties file from the standard Scala library jar.

Has anyone tried to use javax.persistence on Android?

Has anyone tried to use javax.persistence on Android by getting the source or jar and adding it to their project?
Odds are, you will not be able to add the JAR or source. The Android build tools actively block you from importing much in the java.* and javax.* packages.
If Apache Harmony has an implementation of javax.persistence, and you are willing to refactor it to a new package (e.g., via jarjar), you can give it a try.

Categories

Resources