JacksonParser数据绑定和核心原因和QUOT;找到重复文件APK"? [英] JacksonParser databind and core cause "Found duplicate file for APK"?
问题描述
我想学习如何使用杰克逊解析器,以获得更有效的分析对JSON数据。我有这些jar文件: 下载此页面
I'm trying to learn how to use jackson parser, to get more effective parsing on json data. I have these jar files: Downloaded from this page
jackson-core-2.2.0.jar
jackson-annotations-2.2.0.jar
jackson-databind-2.2.0.jar
而在code,我只是尝试解析JSON到一个对象数组:
And in code, i just try to parse a json into an objects array:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String json = ReadFromRaw(this, R.raw.json);
ArrayList<Category> categories = null;
try {
ObjectMapper mapper = new ObjectMapper();
categories = mapper.readValue(json, mapper.getTypeFactory().constructCollectionType(List.class, Category.class));
// categories = mapper.readValue(json, new TypeReference<List<Category>>() {});
} catch (Exception e) {
Log.e("MainActivity", "Error: " + e.getMessage());
}
SimpleListView myList = (SimpleListView) findViewById(R.id.myList);
myList.setAdapterWithItems(GetAdapter(categories));
}
不知道是否有必要,但这里是我的范畴类,以及:
Not sure if necessary, but here is my Category class as well:
@JsonIgnoreProperties({ "DisplayPriority" })
public class Category {
@JsonProperty("Id")
private String categoryId;
@JsonProperty("name")
private String categoryName;
public String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
}
一切似乎都正常,没有错误或警告。但是,当我尝试编译,它给这个错误:
Everything seems ok, there is no error or warnings. But when i try to compile, it gives this error:
[2013-04-25 09:32:08 - Training - JacksonParser] Error generating final archive: Found duplicate file for APK: LICENSE
Origin 1: C:\~\workspace\Training - JacksonParser\libs\jackson-core-2.2.0.jar
Origin 2: C:\~\workspace\Training - JacksonParser\libs\jackson-databind-2.2.0.jar
正如我搜索在谷歌这个错误,它说有一些类常见的这些jar文件。而且我没有做什么,所以任何想法?有什么我做错了什么?否则我缺什么吗?
As i search for this error on google, it says there is some class in common on these jar files. And i do not have any idea about what to do so... Is there something that i do wrong? Or i do something missing?
由于提前,任何帮助是AP preciated。
Thanks in advance, any help is appreciated.
推荐答案
我有同样的问题。 所以,我用的是旧版本。
I have the same problem. So, I use the old version.
杰克逊核心ASL-1.9.12.jar
jackson-core-asl-1.9.12.jar
杰克逊映射器-ASL-1.9.12.jar
jackson-mapper-asl-1.9.12.jar
您可以从最新稳定版本1.x中在同一页面中下载。
You can download from "Latest stable 1.x version" of the same page.
这篇关于JacksonParser数据绑定和核心原因和QUOT;找到重复文件APK&QUOT;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!