Android 什么是安卓依赖?从构建路径中删除它,发生 ClassNotFoundException
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10779868/
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
What is Android Dependencies? Remove it from Build Path, ClassNotFoundException occurs
提问by emeraldhieu
I'm working on a team project. I included a .jar
file in Build Path and committed to SVN. When I updated code in my working directory, a new folder appears in Eclipse called "Android Dependencies". If I let it be there, my program runs; If I remove it, my program reports a ClassNotFoundException
.
我正在做一个团队项目。我.jar
在构建路径中包含了一个文件并提交给了 SVN。当我更新工作目录中的代码时,Eclipse 中会出现一个名为“Android Dependencies”的新文件夹。如果我让它在那里,我的程序就会运行;如果我删除它,我的程序会报告一个ClassNotFoundException
.
Now how to fix this ClassNotFoundException
?
现在如何解决这个问题ClassNotFoundException
?
采纳答案by Codo
Android Dependenciesis a virtual folder where Eclipse shows what JAR files the project depends on. It's not a physical folder; you won't find it on your hard disk. And the folder is not checked in into Subversion.
Android Dependencies是一个虚拟文件夹,Eclipse 会在其中显示项目依赖的 JAR 文件。它不是一个物理文件夹;你不会在你的硬盘上找到它。并且该文件夹未签入 Subversion。
Do not delete that folder. You will destroy your project.
不要删除该文件夹。你会破坏你的项目。
To fix it, just revert to an older Subversion revision and check it in again.
要修复它,只需恢复到较旧的 Subversion 修订版并再次签入即可。
回答by kianatennyson
For the people whose heart dropped when they read the comment that deleting the Android Dependencies virtual folder will destroy your project, there is an easy fix.
对于那些在阅读删除 Android Dependencies 虚拟文件夹会破坏您的项目的评论时心碎的人来说,有一个简单的解决方法。
- Right click on the destroyed project
- Select "Android Tools > Fix Project Properties" in the dropdown
- 右键单击销毁的项目
- 在下拉菜单中选择“Android 工具 > 修复项目属性”
I hosed my project dependencies when trying to set up my git repo, and this is fixed it.
在尝试设置我的 git repo 时,我处理了我的项目依赖项,并且已修复它。
回答by Darragh.McL
I've had a similar problem after setting up a git repo with my project.
在我的项目中设置 git repo 后,我遇到了类似的问题。
The problem was that the appcompat import lost its folder reference.
问题是 appcompat 导入丢失了其文件夹引用。
If the 'Fix Project Properties' mentioned doesn't work for you try this:
如果提到的“修复项目属性”对您不起作用,请尝试以下操作:
- Go to Project > Properties
- Go to the 'Android' tab
- Under 'Libraries', if there's a red 'X' next to the appcompat folder, remove it then hit 'add' and add it in again. The reference should show a green tick now.
- Save and clean the project if needs be
- 转到项目 > 属性
- 转到“Android”标签
- 在“库”下,如果 appcompat 文件夹旁边有一个红色的“X”,请将其删除,然后点击“添加”并再次添加。参考现在应该显示一个绿色的勾号。
- 如果需要,保存并清理项目
回答by Abhinav Saxena
If you also have marked project build target below API level 16 in the Android project properties, the error is going to come because prior to this level, there was no Android dependencies.
如果您还在 Android 项目属性中将项目构建目标标记为低于 API 级别 16,则会出现错误,因为在此级别之前,没有 Android 依赖项。