机器人工作室java.lang.NoClassDefFoundError的: [英] android studio java.lang.NoClassDefFoundError:
问题描述
我做了pretty的很多新项目。我加了 GSON
库由谷歌为我的项目 /库
目录,并增加一条,作为一个图书馆。我也把它添加到我的 build.gradle
为
I've made pretty much a fresh project. I added in the gson
library by google to my projects /libs
directory and added it as a library. I also added it into my build.gradle
as
compile files('libs/gson-2.2.4.jar')
所以,现在看起来一切正常,没有搭载Android工作室给出任何错误,没有红色下划线的任何地方。我可以建立它,并给它一个镜头。
So now everything looks ok, there aren't any errors given by Android Studio, no red underlines anywhere. I can build it and give it a shot.
但后来我遇到这个错误:
But then I run into this error:
java.lang.NoClassDefFoundError: com.google.gson.Gson
我可以在调试器中看到的。事情是我添加它和Android的工作室可以看到,但来构建它给出了问题我所有的不爽。
Which I can see in the debugger. The thing is i've added it in and android studio can see that but come build it gives me all these sorts of problems.
我在做什么错
推荐答案
有同样的问题。我所做的就是摇篮干净
,然后建立我的项目,从控制台的摇篮。在我的 build.gradle
GSON依赖性看起来是这样的:
Had the same issue. What I did was gradle clean
and then build my project with gradle from console. In my build.gradle
gson dependency looks like this:
dependencies {
compile 'com.google.code.gson:gson:2.2.4'
}
这篇关于机器人工作室java.lang.NoClassDefFoundError的:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!