引进项目抛出抛出java.lang.ClassNotFoundException [英] Imported project throws java.lang.ClassNotFoundException

查看:142
本文介绍了引进项目抛出抛出java.lang.ClassNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我进口的现有项目日食和我有很多使其工作的麻烦。该项目附带其他三个库项目:

So I imported an existing project to eclipse and I have a lot of trouble making it work. The project came with three other library projects:


  • google_play_services-LIB

  • google_play_services-lib

CaptureActivity

CaptureActivity

PortraitQR

PortraitQR

当我进口的项目,我在Java构建路径和需要的jar文件添加路径去:

As soon as I imported the project, I went under 'Java Build Path' and added paths for needed jars:

在我成功添加所需的罐子,我去到库。我进口的所有三个所需的库(我是用给定的项目一起),这一切进展顺利:

After I successfully added the needed jars, I went on to the libraries. I imported all three needed libraries (that I was given along with the project) and it all went well:

之后,我也确信私人库导出选项卡下检查:

After that I also made sure private libraries are checked under the export tab:

我做进口后,我试着运行该项目,但它即刻崩溃。这是logcat的文件:

After I was done importing the project I tried to run it but it crashed instantly. This is the logcat file:

07-17 17:33:36.543: E/AndroidRuntime(25965): FATAL EXCEPTION: main
07-17 17:33:36.543: E/AndroidRuntime(25965): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{si.dvanadva.evanturist/si.dvanadva.evanturist.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "si.dvanadva.evanturist.MainActivity" on path: /data/app/si.dvanadva.evanturist-1.apk
07-17 17:33:36.543: E/AndroidRuntime(25965):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at android.os.Handler.dispatchMessage(Handler.java:99)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at android.os.Looper.loop(Looper.java:137)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at android.app.ActivityThread.main(ActivityThread.java:5041)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at java.lang.reflect.Method.invokeNative(Native Method)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at java.lang.reflect.Method.invoke(Method.java:511)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at dalvik.system.NativeStart.main(Native Method)
07-17 17:33:36.543: E/AndroidRuntime(25965): Caused by: java.lang.ClassNotFoundException: Didn't find class "si.dvanadva.evanturist.MainActivity" on path: /data/app/si.dvanadva.evanturist-1.apk
07-17 17:33:36.543: E/AndroidRuntime(25965):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
07-17 17:33:36.543: E/AndroidRuntime(25965):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
07-17 17:33:36.543: E/AndroidRuntime(25965):    ... 11 more

我可以从logcat的文件,这个问题是发现MainActivity类别

I can see from the logcat file that the problem is 'finding MainActivity class'

这是我迄今为止尝试过的解决方案:

Solutions that I have tried so far:


  • 经过,如果MainActivity在AndroidManifest文件正确声明(这是)

  • Checked if MainActivity is correctly declared in the AndroidManifest file (it is)

导出选项卡下经过私人图书馆

Checked private libraries under the export tab

删除bin文件夹和清理项目

Deleted bin folder and cleaned project

我也试图通过不包括包名,宣布在AndroidManifest文件的活动,如:机器人:名字=。activityname

I also tried declaring activities in the AndroidManifest file by not including the package name, like this: android:name=".activityname"

从手机删除该应用程序的previous版本,并试图重新编译

Deleted the previous version of the app from my phone and tried compiling again

检查si.dvanadva.evanturist-1.apk工作区项目,但我不能找到它(我错过了吗?)

Checked for si.dvanadva.evanturist-1.apk in workspace project but I can't find it (am I missing it?)

这个设置JAVA_HOME,但它不能正常工作

Did this to set JAVA_HOME but it doesn't work

开始一个新的Andr​​oid应用程序项目,并在那里复制的文件

Started a new android application project and copied files in there

也许我也试过别的东西,但我忘了提,我一直工作在这相当长的一段时间了,我跑出来的东西去尝试。我会大大AP preciate任何形式的帮助!

Maybe I also tried something else but I forgot to mention it, I've been working on this for quite a while now and I'm running out of things to try. I'll greatly appreciate any kind of help!

推荐答案

我已经相当肯定我见过这样的事情时,我尚未导入code到Eclipse中发生,而是试图运行从它的下载位置如库对于谷歌Play游戏服务:

I've fairly certain I've seen things like this happen when I haven't imported the code into Eclipse, but have tried to run the library from its downloaded location e.g. for Google Play Game Services:

从Android样品导入TypeANumber和BaseGameUtils code
  到工作区。要做到这一点在Eclipse:点击文件>导入>
  Android版>现有的Andr​​oid code到工作区。浏览到
  您下载TypeANumber在开发机器上目录
  并单击确定导入的文件。执行的相同的步骤
  BaseGameUtils。

Import the TypeANumber and BaseGameUtils code from the Android samples into your workspace. To do this in Eclipse: Click File > Import > Android > Existing Android Code into Workspace. Browse to the directory where you downloaded TypeANumber on your development machine and click OK to import the files. Perform the same steps for BaseGameUtils.

(我得到这个从 https://developers.google.com/games/services /安卓/快速入门

同样,虽然这不是问题了精确配合:

Also ,although this is not an exact fit for your problem:

<一个href=\"http://stackoverflow.com/questions/17731591/google-player-game-service-error-cant-build-the-sample-game\">Google玩家游戏服务错误:无法创建示例游戏

这篇关于引进项目抛出抛出java.lang.ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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