Vfy: Unable To Resolve Virtual Method
Solution 1:
I had a similar problem; assuming you're using Eclipse, try the following:
- Right click on your project
- Go to Build Path > Configure Build Path...
- Click on the "Order and Export" tab
- Check the boxes next to your jars, then click OK
- Clean and Build your project, then see if it works.
Hopefully that works.
Solution 2:
This can also happen if you have code calling methods that don't exist in the current device OS version.
For example, if somewhere in your app you call Settings.Global.getFloat(String)
- which was added in api 17 - and the current device is running api 15, you will see this warning in your logs.
There will be a crash if you actually try to invoke this method. There is no problem if you don't call this method. So make sure you always check the current version before calling this.
privatefloatgetAnimationSetting(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);
}
}
privatefloatgetAnimationSettingLegacy(ContentResolver contentResolver,
String setting)throws Settings.SettingNotFoundException {
return Settings.System.getFloat(contentResolver, setting);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)privatefloatgetAnimationSettingJB(ContentResolver contentResolver,
String setting)throws Settings.SettingNotFoundException {
return Settings.Global.getFloat(contentResolver, setting);
}
Solution 3:
In my case, this solution cannot work. Check the code format of jar file is fit as JDK 1.6, I found this issue via changing my lib code format from 1.7 to 1.6, and this issue would be solved.
- To add a external jar on eclipse for Android Project, we can do as this : . Project properties -> Java Build Path -> Libraries then add those External Jar file. . Project properties -> Java Build Path -> Order & Export then checked those External Jar file. You can clean & re-build the target project to see the apk file size and test those functions in external jar.
- To add a external jar on eclipse for Android Project, we can do as this : . copy the jar file to libs of android project, and done. For #1, it is easy to handle multi-projects for one libs. For #2, it is easy to use and no configure required. That's all.
Post a Comment for "Vfy: Unable To Resolve Virtual Method"