库导入问题 [英] Library import issues

查看:120
本文介绍了库导入问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经复制在家里我的工作项目和设置应用程序。我使用GSON而且它位于/ lib文件夹和库引用。然而,在运行时GSON对象无法被实例化和控制台给了我以下

I've copied my work-project and setup app at home. I'm using Gson and it's located in /lib folder and referenced as library. However, during the runtime the Gson object couldn't be instantiated and console gave me the following

一月四日至13日:47:50.948:E / AndroidRuntime(386):致命异常:主要

04-13 01:47:50.948: E/AndroidRuntime(386): FATAL EXCEPTION: main

一月四日至13日:47:50.948:E / AndroidRuntime(386):java.lang.NoClassDefFoundError的:com.google.gson.Gson

04-13 01:47:50.948: E/AndroidRuntime(386): java.lang.NoClassDefFoundError: com.google.gson.Gson

任何建议,好吗?

PS我使用Eclipse和我已经尝试过干净的ING项目,重新GSON库作为参考。

ps I'm using Eclipse and I've already tried "clean"ing the project, resetting Gson library as a referenced.

推荐答案

请确保您使用的是 Android的依赖,并且不添加GSON罐子为引用的库在属性 - > Java构建路径

Make sure you are adding gson jar as an under android dependency and not Referenced Libraries in Properties -> Java Build Path.

如果这并不工作做这些步骤:

If that doesnt work do these steps :


  1. 这是标准的Java构建路径中删除库。

  1. Remove the libraries from the standard Java build path .

在项目名称上单击鼠标右键>属性> Java构建路径>(标签)
库>删除以外的所有的Android x.x代表和Android的依赖关系

Right click on the project name > Properties > Java Build Path >(tab) Libraries > remove everything except the "Android X.X" and the "Android Dependencies"

重命名库从LIB到库

通过这样做,在文件夹库中的所有库由Android插件找到,并添加到Android的依赖。

By doing that, all the libraries in the folder "libs" are found by the Android plugin and are added to the "Android Dependencies".

清洁项目

请参阅这里了解更多详情。

这篇关于库导入问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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