VFY:无法解析虚方法

tol*_*gap 14 android dalvik jackson

我在我的Android应用程序中使用Jackson.

我在构建路径中添加了这两个jar:

jackson-core-asl-1.0.0.jar
jackson-mapper-asl-1.0.0.jar
Run Code Online (Sandbox Code Playgroud)

但是,我在Logcat中一直看到这个:

11-24 18:25:15.093: I/dalvikvm(28842): Could not find method org.codehaus.jackson.map.ObjectMapper.getTypeFactory, referenced from method org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.getJavaType
11-24 18:25:15.093: W/dalvikvm(28842): VFY: unable to resolve virtual method 17967: Lorg/codehaus/jackson/map/ObjectMapper;.getTypeFactory ()Lorg/codehaus/jackson/map/type/TypeFactory;
Run Code Online (Sandbox Code Playgroud)

这只是在那种方法上.我在类似的错误上搜索了StackOverflow,但它们都是:

  • 库错误的版本(我的是正确的)
  • 库不在/ libs中但在/ lib中(我将它们放在/ libs中)

我的Android版本是4.0.3.我正在将它与Spring Android库结合使用.

Erh*_*nis 13

我有类似的问题; 假设您正在使用Eclipse,请尝试以下操作:

  1. 右键单击您的项目
  2. 转到构建路径>配置构建路径...
  3. 单击"订购和导出"选项卡
  4. 选中罐子旁边的复选框,然后单击"确定"
  5. 清理并构建项目,然后查看它是否有效.

希望这有效.

  • 任何人都知道如何在Android Studio中执行此操作? (13认同)

Ped*_*iro 11

如果您具有当前设备操作系统版本中不存在的代码调用方法,也会发生这种情况.

例如,如果您调用的应用程序中的某个位置Settings.Global.getFloat(String)- 已在api 17中添加 - 并且当前设备正在运行api 15,您将在日志中看到此警告.

如果您实际尝试调用此方法,则会发生崩溃.如果不调用此方法,则没有问题.因此,请确保在调用之前始终检查当前版本.

    private float getAnimationSetting(ContentResolver contentResolver,
                                      String setting) throws Settings.SettingNotFoundException {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            return getAnimationSettingJB(contentResolver, setting);
        } else {
            return getAnimationSettingLegacy(contentResolver, setting);
        }
    }

    private float getAnimationSettingLegacy(ContentResolver contentResolver,
                                            String setting) throws Settings.SettingNotFoundException {
        return Settings.System.getFloat(contentResolver, setting);
    }

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    private float getAnimationSettingJB(ContentResolver contentResolver,
                                        String setting) throws Settings.SettingNotFoundException {
        return Settings.Global.getFloat(contentResolver, setting);
    }
Run Code Online (Sandbox Code Playgroud)