java SDK-tools 更新版本后 Android 应用程序崩溃(NoClassDefFound,工具版本 22)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16589821/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android app crashes after SDK-tools update version (NoClassDefFound, tool version 22)
提问by lopez.mikhael
I have just updated my android SDK tools to the newly released version (tools version 22, platform tools version 17)
我刚刚将我的 android SDK 工具更新到新发布的版本(工具版本 22,平台工具版本 17)
java.lang.NoClassDefFoundError
The .classpath file was modified. The update in added a line :
.classpath 文件已修改。更新中添加了一行:
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
Before the SDK tools update, all my projects worked well !!
在 SDK 工具更新之前,我所有的项目都运行良好!!
I corrected my problem in this way :
我以这种方式纠正了我的问题:
- In the project properties (eclipse) -> java build path -> order and export make sure that all your jars in the libs folder are checked.
- And "Android Tools -> Fix Project Properties"
- And "Project -> Clean"
- 在项目属性 (eclipse) -> java build path -> order 和 export 中确保检查 libs 文件夹中的所有 jars。
- 和“Android 工具 -> 修复项目属性”
- 和“项目 - >清洁”
But I don't understand why! Would anybody have an explanation ?
但我不明白为什么!有人会解释吗?
采纳答案by acedanger
I fixed it by going into Java Build Path > Order and Export tab.
我通过进入 Java Build Path > Order and Export 选项卡修复了它。
Click everything in the list"Android Private Libraries".
点击 列表中的所有内容“Android 私人图书馆”。
Then "Project -> Clean". That fixed my issue.
然后“项目-> 清理”。那解决了我的问题。
Just over 1.5 days on this issue, solved my problem by reading Google+.
在这个问题上刚刚超过 1.5 天,通过阅读Google+解决了我的问题。
回答by magicode118
Had the same issue as StylezSoft. To clarify even further, below is my Java Build Path from Eclipse after that I solved the issue (by ticking the android-support-v4.jar
library)
与 StylezSoft 有同样的问题。为了进一步澄清,下面是我从 Eclipse 中得到的 Java 构建路径,之后我解决了这个问题(通过勾选android-support-v4.jar
库)
Then I cleaned the Project (Project > Clean... > OK) and everything worked fine.
然后我清理了项目(项目 > 清理... > 确定),一切正常。
回答by Jordi Moliner
I solve this with Android Tools->Add support Library
我用 Android Tools->Add support Library 解决了这个问题
回答by Hemant G
I had similar issue. But the problem was jar mismatch of "android-support-v4.jar" between Facebook SDK and my application. When I copied the same jar file from Facebook SDK to my application lib folder, the issue was resolved.
我有类似的问题。但问题是 Facebook SDK 和我的应用程序之间“android-support-v4.jar”的 jar 不匹配。当我将相同的 jar 文件从 Facebook SDK 复制到我的应用程序 lib 文件夹时,问题解决了。
回答by user3486184
I ran into this on Android Studio. Since most of the answers here are for Eclipse, here's how to add the supportv4 library on Android Studio:
我在 Android Studio 上遇到了这个问题。由于这里的大部分答案都是针对 Eclipse 的,下面是在 Android Studio 上添加 supportv4 库的方法:
- Build -> Edit Libraries and Dependencies
- Click the + button
- Select the support-v4 library
- Click OK.
- 构建 -> 编辑库和依赖项
- 单击 + 按钮
- 选择 support-v4 库
- 单击确定。
That's it.
而已。
回答by Srikanth Reddy Ramidi
Solutions:
解决方案:
- Check Exports Order
- Enable Multi Dex
- Check api level of views in layout. I faced same problem with searchView. I have check api level while adding searchview but added implements SearchView.OnQueryTextListener to class file.
- Check support Libraries v4,v7 etc
- 检查出口订单
- 启用多 Dex
- 检查布局中的 api 视图级别。我在 searchView 上遇到了同样的问题。我在添加 searchview 时检查了 api 级别,但将实现 SearchView.OnQueryTextListener 添加到类文件。
- 检查支持库 v4、v7 等
回答by StylezSoft
I had a similar issue after the upgrade. The problem in my case was that the android-support-v4.jar library had become unchecked in the Order and Export- list. Check + rebuild solved it for me.
升级后我遇到了类似的问题。我的问题是 android-support-v4.jar 库在 Order and Export- 列表中没有被选中。检查+重建为我解决了它。
The error manifested itself by crashing the app when opening a dialog with a Facebook LoginButton widget on it.
当打开带有 Facebook LoginButton 小部件的对话框时,该错误表现为应用程序崩溃。
回答by Ray
Also need to make sure the Android Dependencies is checked in the Order & Export tab. Both are needed when using other library projects.
还需要确保在 Order & Export 选项卡中选中了 Android Dependencies。使用其他库项目时两者都需要。
回答by Sachin Jain
I had similar issue, following two steps fixed it:-
我有类似的问题,以下两个步骤修复了它:-
Java Build Path -> Order and Export tab.
Then "Project -> Clean".
Java 构建路径 -> 订购和导出选项卡。
然后“项目-> 清理”。