开发者

Resolve error while loading 'dexed' JAR on Android

I'm trying to make a bundle for Felix on Android which may take photos regularly. All the code compiles well and it can be resolved by Felix, but when I try to start it, I get an exception (java.lang.VerifyError) and this trace in logcat :

I/dalvikvm(  738): Failed resolving Lbarcode/android/CameraHandler; interface 1 'Landroid/hardware/Camera$PictureCallback;'
W/dalvikvm(  738): Link of class 'Lbarcode/android/CameraHandler;' failed
E/dalvikvm(  738): ERROR: defineClass(0x40093110, barcode.android.CameraHandler, 0x400c93b8, 0, 1769, 0x开发者_开发百科40204708)

The CameraHandler class opens a Camera object, and implements PictureCallback and AutoFocusCallback.

The .jar file has been 'dexed', via a simple 'dx --dex --output=classes.dex ... && aapt add ... classes.dex'.

I don't know why this error raise, so if someone has a solution...

Thanks


It appears that you've omitted some necessary classes as arguments to dx.

You'll have more success if you use either Android's Eclipse plug-in or the create project action in the android commandline tool. Each of these take care of running the right tools in the right order to build an Android apk to spec.

$ ~/android-sdk/tools/android --help

Usage:
  android [global options] action [action options]

...

Action "create project":
  Creates a new Android Project.
Options:
  -n --name     Project name
  -t --target   Target id of the new project [required]
  -p --path     Location path of new project [required]
  -k --package  Package name [required]
  -a --activity Activity name [required]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜