Android应用程序未处理的异常:找不到类“X”,从法引用'Y' [英] Android application unhandled exception: Could not find class 'X', referenced from method 'Y'

查看:133
本文介绍了Android应用程序未处理的异常:找不到类“X”,从法引用'Y'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个有点新的Andr​​oid开发如此容忍我。

I am a bit new to Android development so bear with me.

我已经审阅本<一个href=\"http://stackoverflow.com/questions/6530022/android-mapview-could-not-find-class-a-referenced-from-method-b\">MapView:无法找到B法引用的类A和该<一个href=\"http://stackoverflow.com/questions/2349244/android-could-not-find-method-xxx-referenced-from-method-yyy\">Could找不到方法XXX,从方法YYY 引用

I've already reviewed this MapView: Could not find class A referenced from method B and this Could not find method XXX, referenced from method YYY

但他们不帮助解决我的问题。

but they do not help solve my issue.

我正试图运行我的应用程序时,报告我的问题标题中的错误。我的应用程序需要我从GitHub,其本身需要的jar文件屈指可数编译自身拉到一个Java项目。我有Java项目编制和Eclipse让我的Andr​​oid项目似乎被编译,但它不工作我的手机上。

I am getting the error reported in my question title when trying to run my app. My app requires a java project that I pulled from Github, which itself required a handful of jar files to compile on its own. I have the java project compiled, and Eclipse makes my android project appear to be compiled, but it isn't working on my phone.

我尝试以下,都导致了同样的结果:

I tried the following, all leading to the same result:


  • 使用Java构建路径所引用的Java库直接

  • 内置的Andr​​oid项目库,引用Java库直接使用Java构建路径,然后加入Android项目库,我的项目的Andr​​oid库路径

  • 内置的Andr​​oid项目库,引用一个罐子我从Java库建,然后加入Android项目库,我的项目的Andr​​oid库路径

  • 建一个罐子从Java库,然后加入罐子我的Andr​​oid项目的构建路径

最终的结果总是相同的,我的程序编译,但是当我尝试运行它崩溃说从GitHub的项目我的主要活动法

the end result is always the same, my program compiles but when I try to run it crashes saying "could not find class "class from the GitHub project" referenced from "my main activity method"

任何人都可以扔骨头?

的logcat

    12-14 11:08:49.792: I/Process(5538): Sending signal. PID: 5538 SIG: 9
12-14 11:09:56.722: D/szipinf(5626): Initializing inflate state
12-14 11:09:56.732: E/dalvikvm(5626): Could not find class 'gmusic.api.impl.GoogleSkyJamAPI', referenced from method com.example.gpmx.MainActivity.runGoogleAPI
12-14 11:09:56.732: W/dalvikvm(5626): VFY: unable to resolve new-instance 445 (Lgmusic/api/impl/GoogleSkyJamAPI;) in Lcom/example/gpmx/MainActivity;
12-14 11:09:56.732: D/dalvikvm(5626): VFY: replacing opcode 0x22 at 0x0000
12-14 11:09:56.732: D/dalvikvm(5626): VFY: dead code 0x0002-0036 in Lcom/example/gpmx/MainActivity;.runGoogleAPI (Ljava/lang/String;Ljava/lang/String;)V
12-14 11:09:56.812: D/AndroidRuntime(5626): Shutting down VM
12-14 11:09:56.812: W/dalvikvm(5626): threadid=1: thread exiting with uncaught exception (group=0x40018560)
12-14 11:09:56.812: E/AndroidRuntime(5626): FATAL EXCEPTION: main
12-14 11:09:56.812: E/AndroidRuntime(5626): java.lang.NoClassDefFoundError: gmusic.api.impl.GoogleSkyJamAPI
12-14 11:09:56.812: E/AndroidRuntime(5626):     at com.example.gpmx.MainActivity.runGoogleAPI(MainActivity.java:63)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at com.example.gpmx.MainActivity.onResume(MainActivity.java:36)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at android.app.Activity.performResume(Activity.java:3832)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2231)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2256)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1789)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at android.app.ActivityThread.access$1500(ActivityThread.java:123)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at android.os.Looper.loop(Looper.java:130)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at android.app.ActivityThread.main(ActivityThread.java:3835)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at java.lang.reflect.Method.invokeNative(Native Method)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at java.lang.reflect.Method.invoke(Method.java:507)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
12-14 11:09:56.812: E/AndroidRuntime(5626):     at dalvik.system.NativeStart.main(Native Method)

还有一个资料片,如果这有助于。我使用的Java项目取决于各种Apache和谷歌罐子,这是在Java项目LIB(不是库)文件夹。创建一个罐子时,这是一个问题吗?

One more piece of information, if this helps. The java project I am using depends on various apache and google jars, which are in the java projects "lib" (not "libs") folder. Is this a problem when creating a jar?

最后更新:
原来,有一个教训。至少我的配置,所有我需要在Android库中的坛子必须是在同一目录级别,也就是刚刚在库。我有一对夫妇需要的jar,如阿帕奇直升机在库common.io它自己的目录中的jar,这是造成问题。

Final update: It turned out that there was a lesson learned. At least with my configuration, all of the jars I needed in the android library had to be at the same directory level, that is, just under "libs". I have a couple of required jars, like apaches common.io jar within it's own directory under "libs", this was causing a problem.

推荐答案

请参阅this SO发布以正确导入现有项目导入Eclipse ...

See this SO post for correctly importing an existing project into Eclipse...

最有用的帖子似乎是:


  1. 文件 - >导入 - >常规 - >现有项目到工作区,下一步

  2. 选择根目录:/​​路径/要/项目

  3. 项目 - >选

  4. 取消勾选​​复制项目进入工作区和添加项目工作集

  5. 完成

将其添加为一个库,用于另一个项目,请参阅此链接从Android开发网站。

To add it as a library for another project, see this link from the Android dev site.


  1. 在Package Explorer中,右键单击该库项目,然后选择属性。

  2. 在属性窗口中,选择左边的Android的属性组,并在右侧找到库属性。

  3. 选择是库复选框并单击Apply。

这篇关于Android应用程序未处理的异常:找不到类“X”,从法引用'Y'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆