> 0 (CONTENT_URI) in Landroid/provider/ContactsContract$CommonDataKinds$Phone;

ContactsContract is an Android 2.0 class. It won't work on earlier
versions. I have an app that uses the contacts API also and solve the
problem with something like this:

public abstract class ContactManager {

public static ContactManager getContactManager(){
 if(version >= 2.0) {
   return new EclairContactManager();
}
else return new CupcakeContactManager();
}
}

So I implement the EclairContactManager and CupcakeContactManager
classes with their respective API calls.
It works fine on any android version >= 1.5

Note that there are absolutely no API calls in this abstract class so
there is no risk of it trying to link to a non-existent class.


On Oct 19, 11:24 pm, Alex Xin <xinxi...@gmail.com> wrote:
> Thank you!  Now I know where I can get those messages.
>
> 10-20 09:18:14.973: WARN/dalvikvm(210): VFY: unable to resolve static field
> 0 (CONTENT_URI) in Landroid/provider/ContactsContract$CommonDataKinds$Phone;
> 10-20 09:18:14.982: WARN/dalvikvm(210): VFY:  rejecting opcode 0x62 at
> 0x0012
> 10-20 09:18:14.982: WARN/dalvikvm(210): VFY:  rejected
> Lxcxin/mysecret/mainSecretActivity;.processContact
> (Landroid/database/Cursor;)V
> 10-20 09:18:14.982: WARN/dalvikvm(210): Verifier rejected class
> Lxcxin/mysecret/mainSecretActivity;
>
> Now I know where I am wrong, ContactsContract.CommonDataKinds is only
> available on API Level 5 or higher.
>
> Thank you all
>
> Alex
>
>
>
>
>
>
>
> On Wed, Oct 20, 2010 at 7:39 AM, DanH <danhi...@ieee.org> wrote:
> > Right ***above*** the exception trace should
> > be some arcane-looking messages with "VFY" in them.
>
> > On Oct 19, 6:36 pm, Alex Xin <xinxi...@gmail.com> wrote:
> > > Hi, thanks for helping me, here's the logcat, you could see it crashes
> > prior
> > > to call my onCreate() method.
>
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204): java.lang.VerifyError:
> > > xcxin.mysecret.mainSecretActivity
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
> > > java.lang.Class.newInstanceImpl(Native Method)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
> > > java.lang.Class.newInstance(Class.java:1472)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
> > > android.app.Instrumentation.newActivity(Instrumentation.java:1097)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
>
> > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
> > > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
> > > android.app.ActivityThread.access$2100(ActivityThread.java:116)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
> > > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
> > > android.os.Handler.dispatchMessage(Handler.java:99)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
> > > android.os.Looper.loop(Looper.java:123)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
> > > android.app.ActivityThread.main(ActivityThread.java:4203)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
> > > java.lang.reflect.Method.invokeNative(Native Method)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
> > > java.lang.reflect.Method.invoke(Method.java:521)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
>
> > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 
> > 791)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
> > > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
> > > 10-20 07:32:27.490: ERROR/AndroidRuntime(204):     at
> > > dalvik.system.NativeStart.main(Native Method)
>
> > > On Wed, Oct 20, 2010 at 7:11 AM, fadden <fad...@android.com> wrote:
> > > > On Oct 19, 2:25 am, Alex Xin <xinxi...@gmail.com> wrote:
> > > > > I have an app that runs perfect on 2.2 and 2.2 but always getting
> > > > > VerifyError on 1.6 while startup, I don't think that my app cannot
> > run
> > > > under
> > > > > 1.6 because I don't call any APIs that don't support 1.6.
>
> > > > Post the output from logcat.  Right above the exception trace should
> > > > be some arcane-looking messages with "VFY" in them.
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> > android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscr...@googlegroups.com<android-developers%2Bunsubs
> > > >  cr...@googlegroups.com>
> > <android-developers%2bunsubscr...@googlegroups.com<android-developers%252Bu 
> > nsubscr...@googlegroups.com>
>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com<android-developers%2Bunsubs 
> > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to