Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a good yaml library for Android?

Tags:

java

android

yaml

Is there a java yaml library as good as snakeyaml for Android? (Or is anyone successfully using snakeyaml on Android already?)

like image 473
MountainX Avatar asked Oct 29 '10 16:10

MountainX


1 Answers

I do not think you can use SnakeYaml on Android without modifications (at least now).

By default, SnakeYaml uses Introspector to get PropertyDescriptors for classes, and as I can see java.beans.Introspector is not available on Android. But there is BeanAccess.FEILD mode in the SnakeYaml which uses fields to dump/load beans. That mode uses only java.lang.reflect classes available on Android.

So, with some modifications it might work. But I need to try it to be sure.

Added

Now android compatible version of SnakeYaml can be build using :

mvn -Pandroid clean package

Update (March 2017):

Starting from 1.18 android build is in central. You can add dependency into your pom.xml like this

<dependency>
  <groupId>org.yaml</groupId>
  <artifactId>snakeyaml</artifactId>
  <version> VERSION </version>
  <classifier>android</classifier>
</dependency>

or in your build.gradle like this:

implementation "org.yaml:snakeyaml:1.18:android"
like image 121
maslovalex Avatar answered Sep 28 '22 20:09

maslovalex