我通过JAR使用commonsguy cwac-camera库: - cwac-camera-v9-0.6.9.jar,我也使用cwac-camera-0.6.9.jar。
当我尝试启动CameraActivity时,我会遇到下一个错误:
08-20 23:12:21.421: E/dalvikvm(1841): Could not find class 'android.hardware.Camera$FaceDetectionListener', referenced from method com.commonsware.cwac.camera.CameraView.onResume
08-20 23:12:21.421: E/dalvikvm(1841): Could not find class 'com.commonsware.cwac.camera.TexturePreviewStrategy', referenced from method com.commonsware.cwac.camera.CameraView.setHost
08-20 23:12:21.460: E/dalvikvm(1841): Could not find class 'android.media.MediaActionSound', referenced from method com.commonsware.cwac.camera.SimpleCameraHost.onAutoFocus
Log from CameraDemo-V9 when try to run on Android 2.3.7.
08-21 21:06:27.580: I/dalvikvm(1541): Could not find method com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout.onHoverEvent, referenced from method com.actionbarsherlock.internal.widget.ActionBarContainer.onHoverEvent
08-21 21:06:27.580: W/dalvikvm(1541): VFY: unable to resolve virtual method 7895: Lcom/actionbarsherlock/internal/nineoldandroids/widget/NineFrameLayout;.onHoverEvent (Landroid/view/MotionEvent;)Z
08-21 21:06:27.580: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x0000
08-21 21:06:27.580: D/dalvikvm(1541): VFY: dead code 0x0003-0004 in Lcom/actionbarsherlock/internal/widget/ActionBarContainer;.onHoverEvent (Landroid/view/MotionEvent;)Z
08-21 21:06:27.580: I/dalvikvm(1541): Could not find method android.widget.FrameLayout.getAlpha, referenced from method com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout.getAlpha
08-21 21:06:27.580: W/dalvikvm(1541): VFY: unable to resolve virtual method 6574: Landroid/widget/FrameLayout;.getAlpha ()F
08-21 21:06:27.580: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000b
08-21 21:06:27.580: D/dalvikvm(1541): VFY: dead code 0x000e-000f in Lcom/actionbarsherlock/internal/nineoldandroids/widget/NineFrameLayout;.getAlpha ()F
08-21 21:06:27.580: I/dalvikvm(1541): Could not find method android.widget.FrameLayout.getTranslationY, referenced from method com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout.getTranslationY
08-21 21:06:27.580: W/dalvikvm(1541): VFY: unable to resolve virtual method 6575: Landroid/widget/FrameLayout;.getTranslationY ()F
08-21 21:06:27.580: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000b
08-21 21:06:27.580: D/dalvikvm(1541): VFY: dead code 0x000e-000f in Lcom/actionbarsherlock/internal/nineoldandroids/widget/NineFrameLayout;.getTranslationY ()F
08-21 21:06:27.580: I/dalvikvm(1541): Could not find method android.widget.FrameLayout.setAlpha, referenced from method com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout.setAlpha
08-21 21:06:27.580: W/dalvikvm(1541): VFY: unable to resolve virtual method 6578: Landroid/widget/FrameLayout;.setAlpha (F)V
08-21 21:06:27.580: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000a
08-21 21:06:27.580: D/dalvikvm(1541): VFY: dead code 0x000d-000d in Lcom/actionbarsherlock/internal/nineoldandroids/widget/NineFrameLayout;.setAlpha (F)V
08-21 21:06:27.580: I/dalvikvm(1541): Could not find method android.widget.FrameLayout.setTranslationY, referenced from method com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout.setTranslationY
08-21 21:06:27.580: W/dalvikvm(1541): VFY: unable to resolve virtual method 6585: Landroid/widget/FrameLayout;.setTranslationY (F)V
08-21 21:06:27.580: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000a
08-21 21:06:27.580: D/dalvikvm(1541): VFY: dead code 0x000d-000d in Lcom/actionbarsherlock/internal/nineoldandroids/widget/NineFrameLayout;.setTranslationY (F)V
08-21 21:06:27.580: I/dalvikvm(1541): Could not find method android.view.ViewGroup.getAlpha, referenced from method com.actionbarsherlock.internal.nineoldandroids.view.NineViewGroup.getAlpha
08-21 21:06:27.580: W/dalvikvm(1541): VFY: unable to resolve virtual method 6251: Landroid/view/ViewGroup;.getAlpha ()F
08-21 21:06:27.580: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000b
08-21 21:06:27.580: D/dalvikvm(1541): VFY: dead code 0x000e-000f in Lcom/actionbarsherlock/internal/nineoldandroids/view/NineViewGroup;.getAlpha ()F
08-21 21:06:27.580: I/dalvikvm(1541): Could not find method android.view.ViewGroup.getTranslationX, referenced from method com.actionbarsherlock.internal.nineoldandroids.view.NineViewGroup.getTranslationX
08-21 21:06:27.580: W/dalvikvm(1541): VFY: unable to resolve virtual method 6263: Landroid/view/ViewGroup;.getTranslationX ()F
08-21 21:06:27.580: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000b
08-21 21:06:27.580: D/dalvikvm(1541): VFY: dead code 0x000e-000f in Lcom/actionbarsherlock/internal/nineoldandroids/view/NineViewGroup;.getTranslationX ()F
08-21 21:06:27.580: I/dalvikvm(1541): Could not find method android.view.ViewGroup.getTranslationY, referenced from method com.actionbarsherlock.internal.nineoldandroids.view.NineViewGroup.getTranslationY
08-21 21:06:27.580: W/dalvikvm(1541): VFY: unable to resolve virtual method 6264: Landroid/view/ViewGroup;.getTranslationY ()F
08-21 21:06:27.580: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000b
08-21 21:06:27.580: D/dalvikvm(1541): VFY: dead code 0x000e-000f in Lcom/actionbarsherlock/internal/nineoldandroids/view/NineViewGroup;.getTranslationY ()F
08-21 21:06:27.580: I/dalvikvm(1541): Could not find method android.view.ViewGroup.setAlpha, referenced from method com.actionbarsherlock.internal.nineoldandroids.view.NineViewGroup.setAlpha
08-21 21:06:27.580: W/dalvikvm(1541): VFY: unable to resolve virtual method 6287: Landroid/view/ViewGroup;.setAlpha (F)V
08-21 21:06:27.580: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000a
08-21 21:06:27.580: D/dalvikvm(1541): VFY: dead code 0x000d-000d in Lcom/actionbarsherlock/internal/nineoldandroids/view/NineViewGroup;.setAlpha (F)V
08-21 21:06:27.580: I/dalvikvm(1541): Could not find method android.view.ViewGroup.setTranslationX, referenced from method com.actionbarsherlock.internal.nineoldandroids.view.NineViewGroup.setTranslationX
08-21 21:06:27.580: W/dalvikvm(1541): VFY: unable to resolve virtual method 6293: Landroid/view/ViewGroup;.setTranslationX (F)V
08-21 21:06:27.580: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000a
08-21 21:06:27.580: D/dalvikvm(1541): VFY: dead code 0x000d-000d in Lcom/actionbarsherlock/internal/nineoldandroids/view/NineViewGroup;.setTranslationX (F)V
08-21 21:06:27.580: I/dalvikvm(1541): Could not find method android.view.ViewGroup.setTranslationY, referenced from method com.actionbarsherlock.internal.nineoldandroids.view.NineViewGroup.setTranslationY
08-21 21:06:27.580: W/dalvikvm(1541): VFY: unable to resolve virtual method 6294: Landroid/view/ViewGroup;.setTranslationY (F)V
08-21 21:06:27.580: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000a
08-21 21:06:27.580: D/dalvikvm(1541): VFY: dead code 0x000d-000d in Lcom/actionbarsherlock/internal/nineoldandroids/view/NineViewGroup;.setTranslationY (F)V
08-21 21:06:27.590: I/dalvikvm(1541): Could not find method com.actionbarsherlock.internal.widget.ActionBarView$HomeView.onHoverEvent, referenced from method com.actionbarsherlock.internal.widget.ActionBarView$HomeView.dispatchHoverEvent
08-21 21:06:27.590: W/dalvikvm(1541): VFY: unable to resolve virtual method 8756: Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;.onHoverEvent (Landroid/view/MotionEvent;)Z
08-21 21:06:27.590: D/dalvikvm(1541): VFY: replacing opcode 0x6e at 0x0000
08-21 21:06:27.590: D/dalvikvm(1541): VFY: dead code 0x0003-0004 in Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;.dispatchHoverEvent (Landroid/view/MotionEvent;)Z
08-21 21:06:27.590: I/dalvikvm(1541): Could not find method android.widget.FrameLayout.onPopulateAccessibilityEvent, referenced from method com.actionbarsherlock.internal.widget.ActionBarView$HomeView.onPopulateAccessibilityEvent
08-21 21:06:27.590: W/dalvikvm(1541): VFY: unable to resolve virtual method 6577: Landroid/widget/FrameLayout;.onPopulateAccessibilityEvent (Landroid/view/accessibility/AccessibilityEvent;)V
08-21 21:06:27.590: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x0006
08-21 21:06:27.590: I/dalvikvm(1541): Could not find method android.view.View.jumpDrawablesToCurrentState, referenced from method com.actionbarsherlock.internal.view.menu.BaseMenuPresenter.updateMenuView
08-21 21:06:27.590: W/dalvikvm(1541): VFY: unable to resolve virtual method 6136: Landroid/view/View;.jumpDrawablesToCurrentState ()V
08-21 21:06:27.590: D/dalvikvm(1541): VFY: replacing opcode 0x6e at 0x0056
08-21 21:06:27.590: I/dalvikvm(1541): Could not find method android.widget.LinearLayout.getAlpha, referenced from method com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout.getAlpha
08-21 21:06:27.590: W/dalvikvm(1541): VFY: unable to resolve virtual method 6628: Landroid/widget/LinearLayout;.getAlpha ()F
08-21 21:06:27.590: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000b
08-21 21:06:27.590: D/dalvikvm(1541): VFY: dead code 0x000e-000f in Lcom/actionbarsherlock/internal/nineoldandroids/widget/NineLinearLayout;.getAlpha ()F
08-21 21:06:27.590: I/dalvikvm(1541): Could not find method android.widget.LinearLayout.getTranslationX, referenced from method com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout.getTranslationX
08-21 21:06:27.590: W/dalvikvm(1541): VFY: unable to resolve virtual method 6631: Landroid/widget/LinearLayout;.getTranslationX ()F
08-21 21:06:27.590: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000b
08-21 21:06:27.590: D/dalvikvm(1541): VFY: dead code 0x000e-000f in Lcom/actionbarsherlock/internal/nineoldandroids/widget/NineLinearLayout;.getTranslationX ()F
08-21 21:06:27.590: I/dalvikvm(1541): Could not find method android.widget.LinearLayout.setAlpha, referenced from method com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout.setAlpha
08-21 21:06:27.590: W/dalvikvm(1541): VFY: unable to resolve virtual method 6643: Landroid/widget/LinearLayout;.setAlpha (F)V
08-21 21:06:27.590: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000a
08-21 21:06:27.590: D/dalvikvm(1541): VFY: dead code 0x000d-000d in Lcom/actionbarsherlock/internal/nineoldandroids/widget/NineLinearLayout;.setAlpha (F)V
08-21 21:06:27.590: I/dalvikvm(1541): Could not find method android.widget.LinearLayout.setTranslationX, referenced from method com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout.setTranslationX
08-21 21:06:27.590: W/dalvikvm(1541): VFY: unable to resolve virtual method 6649: Landroid/widget/LinearLayout;.setTranslationX (F)V
08-21 21:06:27.590: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x000a
08-21 21:06:27.590: D/dalvikvm(1541): VFY: dead code 0x000d-000d in Lcom/actionbarsherlock/internal/nineoldandroids/widget/NineLinearLayout;.setTranslationX (F)V
08-21 21:06:27.590: W/KeyCharacterMap(1541): No keyboard for id -1
08-21 21:06:27.600: W/KeyCharacterMap(1541): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
08-21 21:06:27.600: I/dalvikvm(1541): Could not find method com.actionbarsherlock.internal.view.menu.ActionMenuItemView.onHoverEvent, referenced from method com.actionbarsherlock.internal.view.menu.ActionMenuItemView.dispatchHoverEvent
08-21 21:06:27.600: W/dalvikvm(1541): VFY: unable to resolve virtual method 8053: Lcom/actionbarsherlock/internal/view/menu/ActionMenuItemView;.onHoverEvent (Landroid/view/MotionEvent;)Z
08-21 21:06:27.600: D/dalvikvm(1541): VFY: replacing opcode 0x6e at 0x0006
08-21 21:06:27.600: D/dalvikvm(1541): VFY: dead code 0x0009-0009 in Lcom/actionbarsherlock/internal/view/menu/ActionMenuItemView;.dispatchHoverEvent (Landroid/view/MotionEvent;)Z
08-21 21:06:27.600: I/dalvikvm(1541): Could not find method android.widget.LinearLayout.onPopulateAccessibilityEvent, referenced from method com.actionbarsherlock.internal.view.menu.ActionMenuItemView.onPopulateAccessibilityEvent
08-21 21:06:27.600: W/dalvikvm(1541): VFY: unable to resolve virtual method 6640: Landroid/widget/LinearLayout;.onPopulateAccessibilityEvent (Landroid/view/accessibility/AccessibilityEvent;)V
08-21 21:06:27.600: D/dalvikvm(1541): VFY: replacing opcode 0x6f at 0x0006
08-21 21:06:27.610: I/dalvikvm(1541): Could not find method android.media.CamcorderProfile.hasProfile, referenced from method com.commonsware.cwac.camera.SimpleCameraHost.configureRecorderProfile
08-21 21:06:27.610: W/dalvikvm(1541): VFY: unable to resolve static method 660: Landroid/media/CamcorderProfile;.hasProfile (II)Z
08-21 21:06:27.610: D/dalvikvm(1541): VFY: replacing opcode 0x71 at 0x0008
08-21 21:06:27.610: D/dalvikvm(1541): VFY: dead code 0x000b-000d in Lcom/commonsware/cwac/camera/SimpleCameraHost;.configureRecorderProfile (ILandroid/media/MediaRecorder;)V
08-21 21:06:27.610: D/dalvikvm(1541): VFY: dead code 0x0016-002f in Lcom/commonsware/cwac/camera/SimpleCameraHost;.configureRecorderProfile (ILandroid/media/MediaRecorder;)V
08-21 21:06:27.610: I/dalvikvm(1541): Could not find method android.hardware.Camera$Parameters.getPreferredPreviewSizeForVideo, referenced from method com.commonsware.cwac.camera.SimpleCameraHost.getPreferredPreviewSizeForVideo
08-21 21:06:27.610: W/dalvikvm(1541): VFY: unable to resolve virtual method 615: Landroid/hardware/Camera$Parameters;.getPreferredPreviewSizeForVideo ()Landroid/hardware/Camera$Size;
08-21 21:06:27.610: D/dalvikvm(1541): VFY: replacing opcode 0x6e at 0x0009
08-21 21:06:27.610: D/dalvikvm(1541): VFY: dead code 0x000c-000d in Lcom/commonsware/cwac/camera/SimpleCameraHost;.getPreferredPreviewSizeForVideo (IIILandroid/hardware/Camera$Parameters;Landroid/hardware/Camera$Size;)Landroid/hardware/Camera$Size;
08-21 21:06:27.610: E/dalvikvm(1541): Could not find class 'android.media.MediaActionSound', referenced from method com.commonsware.cwac.camera.SimpleCameraHost.onAutoFocus
08-21 21:06:27.610: W/dalvikvm(1541): VFY: unable to resolve new-instance 127 (Landroid/media/MediaActionSound;) in Lcom/commonsware/cwac/camera/SimpleCameraHost;
08-21 21:06:27.610: D/dalvikvm(1541): VFY: replacing opcode 0x22 at 0x0008
08-21 21:06:27.610: D/dalvikvm(1541): VFY: dead code 0x000a-0010 in Lcom/commonsware/cwac/camera/SimpleCameraHost;.onAutoFocus (ZLandroid/hardware/Camera;)V
08-21 21:06:27.610: I/dalvikvm(1541): Could not find method android.hardware.Camera$Parameters.setRecordingHint, referenced from method com.commonsware.cwac.camera.CameraView.initPreview
08-21 21:06:27.610: W/dalvikvm(1541): VFY: unable to resolve virtual method 624: Landroid/hardware/Camera$Parameters;.setRecordingHint (Z)V
08-21 21:06:27.610: D/dalvikvm(1541): VFY: replacing opcode 0x6e at 0x0028
08-21 21:06:27.620: E/dalvikvm(1541): Could not find class 'android.hardware.Camera$FaceDetectionListener', referenced from method com.commonsware.cwac.camera.CameraView.onResume
08-21 21:06:27.620: W/dalvikvm(1541): VFY: unable to resolve instanceof 116 (Landroid/hardware/Camera$FaceDetectionListener;) in Lcom/commonsware/cwac/camera/CameraView;
08-21 21:06:27.620: D/dalvikvm(1541): VFY: replacing opcode 0x20 at 0x0040
08-21 21:06:27.620: D/dalvikvm(1541): VFY: dead code 0x0042-004e in Lcom/commonsware/cwac/camera/CameraView;.onResume ()V
08-21 21:06:27.620: I/dalvikvm(1541): Failed resolving Lcom/commonsware/cwac/camera/TexturePreviewStrategy; interface 870 'Landroid/view/TextureView$SurfaceTextureListener;'
08-21 21:06:27.620: W/dalvikvm(1541): Link of class 'Lcom/commonsware/cwac/camera/TexturePreviewStrategy;' failed
08-21 21:06:27.620: E/dalvikvm(1541): Could not find class 'com.commonsware.cwac.camera.TexturePreviewStrategy', referenced from method com.commonsware.cwac.camera.CameraView.setHost
08-21 21:06:27.620: W/dalvikvm(1541): VFY: unable to resolve new-instance 1283 (Lcom/commonsware/cwac/camera/TexturePreviewStrategy;) in Lcom/commonsware/cwac/camera/CameraView;
08-21 21:06:27.630: D/dalvikvm(1541): VFY: replacing opcode 0x22 at 0x000c
08-21 21:06:27.630: D/dalvikvm(1541): VFY: dead code 0x000e-0012 in Lcom/commonsware/cwac/camera/CameraView;.setHost (Lcom/commonsware/cwac/camera/CameraHost;)V
08-21 21:06:27.630: I/dalvikvm(1541): Could not find method android.hardware.Camera$Parameters.getMaxNumDetectedFaces, referenced from method com.commonsware.cwac.camera.CameraView.startFaceDetection
08-21 21:06:27.630: W/dalvikvm(1541): VFY: unable to resolve virtual method 613: Landroid/hardware/Camera$Parameters;.getMaxNumDetectedFaces ()I
08-21 21:06:27.630: D/dalvikvm(1541): VFY: replacing opcode 0x6e at 0x0014
08-21 21:06:27.630: D/dalvikvm(1541): VFY: dead code 0x0017-0021 in Lcom/commonsware/cwac/camera/CameraView;.startFaceDetection ()V
08-21 21:06:27.630: I/dalvikvm(1541): Could not find method android.hardware.Camera.stopFaceDetection, referenced from method com.commonsware.cwac.camera.CameraView.stopFaceDetection
08-21 21:06:27.630: W/dalvikvm(1541): VFY: unable to resolve virtual method 645: Landroid/hardware/Camera;.stopFaceDetection ()V
08-21 21:06:27.630: D/dalvikvm(1541): VFY: replacing opcode 0x6e at 0x0010
08-21 21:06:27.760: D/(1541): HostConnection::get() New Host Connection established 0x9ae5b68, tid 1541
08-21 21:06:27.780: D/dalvikvm(1541): GC_EXTERNAL_ALLOC freed 207K, 49% free 2868K/5575K, external 3178K/3266K, paused 5ms
08-21 21:06:27.791: D/dalvikvm(1541): GC_EXTERNAL_ALLOC freed 8K, 49% free 2859K/5575K, external 3366K/4166K, paused 10ms
如何为Android级别添加对设备的支持< 11?
答案 0 :(得分:1)
这些是正常的。只要您的代码引用了运行您的应用程序的API级别上不存在的某个类,您就会获得这些代码。但是,只要代码实际上不执行引用缺少类的Java语句,一切都很好。
答案 1 :(得分:0)
那我怎么能告诉它呢?
引用the current version of the documentation:
要整合核心AAR,Gradle配方是:
repositories {
maven {
url "https://repo.commonsware.com.s3.amazonaws.com"
}
}
dependencies {
compile 'com.commonsware.cwac:camera:0.6.+'
}
您似乎添加了dependencies
但未更新repositories
。