ClassNotFoundException, когда класс существует - PullRequest
0 голосов
/ 12 июня 2011

Я пытаюсь использовать Android-Bluetooth-симулятор от cheng81.

Я продолжаю получать ClassNotFoundException.Я проверил, и файл jar с классом включен в путь сборки проекта.Я отсканировал файл jar, чтобы проверить, был ли там класс, и он нашел его.

Что я мог сделать не так?

Uncaught handler: thread main exiting due to uncaught exception
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{dk.itu.android.btemu/dk.itu.android.btemu.BTEnableControl}: java.lang.ClassNotFoundException: dk.itu.android.btemu.BTEnableControl in loader dalvik.system.PathClassLoader@44c067f0
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
       at android.app.ActivityThread.access$2200(ActivityThread.java:119)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:123)
       at android.app.ActivityThread.main(ActivityThread.java:4363)
       at java.lang.reflect.Method.invokeNative(NativeMethod)
       at java.lang.reflect.Method.invoke(Method.java:521)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
       at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: dk.itu.android.btemu.BTEnableControl in loader dalvik.system.PathClassLoader@44c067f0
       at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
       at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
       ... 11 more

Поиск:

E:\Documents and Settings\Jonathan\Desktop\Firefox Downloads>java -jar jarscan.
ar -dir "E:\Program Files\Android\cheng81-Android-Bluetooth-Simulator-68aca94"
class BTEnableControl

=========================
JarScan
written by Geoff Yaworski
gyaworski@hotmail.com
Version 2.0
=========================

Will start search from: E:\Program Files\Android\cheng81-Android-Bluetooth-Simu
ator-68aca94

Looking for class(es): [BTEnableControl]

Processed 0 directories containing 2 files
found 2 libraries under the directory: E:\Program Files\Android\cheng81-Android
Bluetooth-Simulator-68aca94

1) btsim.jar [E:\Program Files\Android\cheng81-Android-Bluetooth-Simulator-68ac
94\btsim.jar]
2) btsimserver.jar [E:\Program Files\Android\cheng81-Android-Bluetooth-Simulator
-68aca94\btsimserver.jar]

searching these jarfiles now ....

===============================================
Found: BTEnableControl
Class: dk.itu.android.btemu.BTEnableControl
Package: dk.itu.android.btemu
Library Name: btsim.jar
Library Path: E:\Program Files\Android\cheng81-Android-Bluetooth-Simulator-68ac
94\btsim.jar
===============================================
...