-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
集成在Android项目中报异常,自己想了很多办法没搞定 #11
Comments
android 支持还要等一等,估计对于android来说最好是搞静态的代码生成。或者纯用反射。今天测了一下,纯反射仍然比jackson快一倍。 |
搞了一个静态代码生成的方案 执行后产生decoder的源代码。执行的目录应该是src/main/java的位置。然后使用的时候 把执行模式切换为使用静态生成的decoder JsonIterator.setMode(DecodingMode.STATIC_MODE); 这里的类是代码生成的:https://github.com/json-iterator/java/tree/master/demo/src/main/java/decoder |
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>static-codegen</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<workingDirectory>${project.build.sourceDirectory}</workingDirectory>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>com.jsoniter.StaticCodeGenerator</argument>
<argument>com.jsoniter.demo.codegen.DemoCodegenConfig</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin> |
com.jsoniter.JsonException: must execute static code generator in the java source code directory which contains: main/java/com/jsoniter/demo/DemoCodegenConfig.java 不太理解这种方式,产生decoder的源代码的时候报上面的异常信息.有点蒙 |
我试着将Jar放在Android项目中,解析时报异常,自己也试着解决但没有搞定
com.jsoniter.JsonException: javassist.NotFoundException: com.jsoniter.spi.Decoder
不知道是不是跟javassist有关系?
The text was updated successfully, but these errors were encountered: