在Eclipse Android的支持 - v4.jar没有正确导入正确、Android、Eclipse、jar

2023-09-05 10:22:17 作者:青冢暮

我试图让一个应用程序编译使用 Android的支持 - v4.jar 碎片类包含,但我不断收到的消息,每当我试图编译,有在code错误。所有的错误都与不同碎片类是在 .JAR 。我曾尝试 CTRL单击项目文件夹,然后选择 Android的工具 - >添加兼容库和我不断收到此错误:

  [2011-12-20 11点55分31秒 -  Android的兼容性JAR未发现:]
/Applications/eclipse/Eclipse.app/Contents/MacOS/v4/android-support-v4.jar
 

为什么会在Eclipse的包内容进行寻找 .JAR ?我已经去到项目属性,就到了Java构建路径,并导入了 .JAR 从 MainActivity /库文件夹,没有工作,然后我试图从我的SDK目录导入,并没有奏效。我已经解决了项目属性,清理和建造它无数次,我已经重新启动Eclipse的,我的电脑,重新下载和安装了Eclipse,Android SDK中的和ADT,仍然一无所获。我完全难住了。

修改

我已经通过构建路径走了,无论从 MainActivity /库和我的SDK目录中导入该.jar。对于它的地狱,我添加了.JAR在不断出现在错误的目录中,并没有奏效。什么使Eclipse中寻找它在它的应用程序包的内容?

更新

所以修修补补后该项目内容没有显示出任何错误,但MainActivity文件夹仍然说是有一个,我还是不能编译。

像nyah:

修订

所以我觉得这个问题可能是为什么Eclipse中寻找Eclipse的应用程序的包内容,而不是项目目录或在Android SDK中的.jar目录中,我用导入它作为一个外部.jar?

更新#2

我只得到一个错误之​​后,修修补补,现在,它的这种方法:

  @覆盖
公共菜单项setOnActionExpandListener(OnActionExpandListener onActionExpandListener){
    //空操作
    回到这一点;
}
 

快速修正说我应该删除@Override注解,但是这种方法必须重写一个超类的方法。

Eclipse关联android support v4包的两种方法

这些都是错误的,它显示:

 在该行多个标记
 - 该方法setOnActionExpandListener类型SimpleMenuItem的(MenuItem.OnActionExpandListener)必须覆盖一个超类方法
 - 实现android.view.MenuItem.setOnActionExpandListener
 

解决方案

事实证明,我的调试证书已经过期了,所以我只需要删除〜/ .android / debug.keystore 键,重新启动Eclipse和一切工作。

I'm trying to get an app to compile that uses the android-support-v4.jar and the Fragmentation classes it contains, but I keep getting messages whenever I try to compile that there are errors in the code. All of the errors have to do with different Fragmentation classes that are in the .JAR. I have tried ctrl-clicking the project folder and then selecting Android Tools -> Add Compatibility Library and I keep getting this error:

[2011-12-20 11:55:31 - Android Compatibility JAR not found:]
/Applications/eclipse/Eclipse.app/Contents/MacOS/v4/android-support-v4.jar

Why would it be looking for the .JAR in Eclipse's Package Contents? I've gone into the project properties and went to the Java Build Path, and imported the .JAR from the MainActivity/libs folder, that didn't work, and then I tried to import it from my SDK directory, and that didn't work. I've fixed the project properties and cleaned and built it countless times, I've restarted Eclipse, my computer, re-downloaded and installed Eclipse, the Android SDK's and ADT and still nothing. I am completely stumped.

Edit

I've gone through the build path and imported the .JAR from both the MainActivity/libs and my SDK directory. For the hell of it I added the .JAR in the directory that keeps appearing in the errors and that hasn't worked. What's making Eclipse look for it in it's Application Package Contents?

Update

So after tinkering the project contents aren't showing any errors but the MainActivity folder still says that there is one and I still can't compile.

Like nyah:

Revision

So I think the question may be "Why is Eclipse looking for the .JAR in the Eclipse Application's package contents instead of the libs directory of the project or the Android SDK directory that I used to import it as an external .JAR?"

Update #2

I am only getting one error now after tinkering, it's on this method:

@Override
public MenuItem setOnActionExpandListener(OnActionExpandListener onActionExpandListener) {
    // Noop
    return this;
}

The Quick Fix says that I should delete the @Override annotation but that method must override a super class method.

These are the errors that it shows:

Multiple markers at this line
- The method setOnActionExpandListener(MenuItem.OnActionExpandListener) of type SimpleMenuItem must override a superclass method
- implements android.view.MenuItem.setOnActionExpandListener

解决方案

It turns out that my Debug Certificate had expired so I just needed to delete ~/.android/debug.keystore and restart Eclipse and everything worked.

 
精彩推荐
图片推荐