为什么不能发现的android com.google.gson.Gson [英] Why can't android find com.google.gson.Gson

查看:813
本文介绍了为什么不能发现的android com.google.gson.Gson的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用GSON在我的项目,但我的应用程序崩溃,与logcat的话说,com.google.gson.Gson无法找到。我已经把进口com.google.gson.Gson我的类文件,我已经GSON在我的包浏览器,并通过右击将其添加 - >构建路径 - >添加库。它也显示在项目 - >属性 - > Java构建path->库选项卡 - > GSON。我做了什么错?

I'm trying to use GSON in my project, but my application is crashing, with logcat saying that com.google.gson.Gson cannot be found. I've put import com.google.gson.Gson on my class files, I have gson in my package explorer, and added it by Right click -> build path -> add libraries. It also shows up in Project->properties->java build path->libraries tab->gson. What have I done wrong?

推荐答案

什么工作对我来说:选中该复选框旁边LIB(GSON-2.0.jar)中:项目属性 - >Java构建路径 - >订单和导出选项卡。然后做一个干净的/构建。

What worked for me: Check the checkbox next to the lib (gson-2.0.jar) in: 'Project Properties' -> 'Java Build Path' -> 'Order and Export' tab. Then do a clean/build.

这增加了出口= true属性的类路径条目

This adds the exported=true attribute to the classpath entry

<classpathentry exported="true" kind="lib" path="libs/gson-2.0.jar"/>

这篇关于为什么不能发现的android com.google.gson.Gson的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆