我在这里可能已经咬得太多了。为了使用 Android SDK,我第一次走出了 .net / Visual Studio 的舒适区。我正在(尝试)使用 IntelliJ。
我有一个单模块项目。我想“引用”google gson 库。经过几个小时在项目结构对话框中使用工具、谷歌搜索、阅读 IntelliJ 帮助并嘲笑自己的无能,我至少成功构建了一个。
但是,当我部署到虚拟设备时,我注意到“logcat”显示:
找不到课程
'com.google.gson.Gson',引用
从方法
com.example.HelloW$ClientThread.run
我假设这与我的代码关系不大,而与我最终如何引用 gson-1.7.1.jar 文件有关?
有人可以用最简单的术语告诉我如何成功添加该依赖项吗?
I may have bitten off more than i can chew here. I've moved outside of my .net / visual studio comfort zone for the first time in order to play with the Android SDK. I'm (attempting) to use IntelliJ.
I have a single module project. I want to "reference" the google gson library. After hours of tooling around in the project structure dialog, googling, reading the IntelliJ help and laughing at my own ineptness I managed to at least get a successful build.
However when i deploy to the virtual device, I note the "logcat" shows:
Could not find class
'com.google.gson.Gson', referenced
from method
com.example.HelloW$ClientThread.run
I'm assuming this is less to do with my code, and everything to do with how i ended up referencing the gson-1.7.1.jar file?
Can somebody tell me in the simplest terms how i add that dependancy successfully?
发布评论
评论(1)
将 jar 文件添加到依赖项很容易,您可以在 官方文档。
确保库范围设置为编译。
以下是显示“lib”库的示例,其中包含添加到模块依赖项中的几个 jar:
Adding jar file to Dependencies is easy and you can find the details in the official documentation.
Make sure that the library scope is set to Compile.
Here is the sample showing "lib" library that contains a couple of jars added to the module dependencies: