Hi all,
I've been struggling with what seems like a straightforward issue for
some time now, and any suggestions would be appreciated.

- I created a very simple content provider that extends
ContentProvider and does the basic six tasks (onCreate, query, etc.).
- I created a Constants class as such:
public class Constants {
        public static final String AUTHORITY = "content://
com.companyname.provider.provider";
        public static final Uri CONTENT_URI = Uri.parse(AUTHORITY);

        public static final String DEFAULT_SORT_ORDER = "contactid ASC";

        public static final String _ID = "_id";
        public static final String CONTACTID = "contactid";
        public static final String TYPE = "type";
}

- Finally, I created a _separate_ content provider test application,
with a separate package name.  It runs the following test:
        String[] projection = new String[] {
                        Constants._ID,
                        Constants.CONTACTID,
                        Constants.TYPE
        };

        Uri contacts =  Constants.CONTENT_URI;
}

- When the "URI contacts = Constants.CONTENT_URI" line is active, as
shown above, I consistently receive the following errors:

W/dalvikvm(  590): VFY: unable to resolve static field 5 (CONTENT_URI)
in Lcom/companyname/provider/Constants;
W/dalvikvm(  590): VFY:  rejecting opcode 0x62 at 0x001b
W/dalvikvm(  590): VFY:  rejected Lcom/companyname/contentprovidertest/
ContentProviderTest;.testContentProvider ()V
W/dalvikvm(  590): Verifier rejected class Lcom/companyname/
contentprovidertest/ContentProviderTest;
W/dalvikvm(  590): Class init failed in newInstance call (Lcom/
companyname/contentprovidertest/ContentProviderTest;)
D/AndroidRuntime(  590): Shutting down VM
W/dalvikvm(  590): threadid=3: thread exiting with uncaught exception
(group=0x4001da28)
E/AndroidRuntime(  590): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime(  590): java.lang.VerifyError:
com.companyname.contentprovidertest.ContentProviderTest
E/AndroidRuntime(  590):        at java.lang.Class.newInstanceImpl(Native
Method)
(and more)

- When the "URI contacts = Constants.CONTENT_URI" line is commented
out, the simple test succeeds, and I am able to access the strings.

- The second, test application was built with the original app (with
the content provider) in the "Projects" build path.

Is this an issue with using complex data sources (e.g.
android.net.Uri)?
Is this a build or link problem?
What build suggestions do you all have to getting around this?

Thanks so much,
jsdf
--~--~---------~--~----~------------~-------~--~----~
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