[android-developers] Re: VerifyError and Content Providers

2009-10-29 Thread Javen

Have you resolved it? and how
I have the same problem as yours.

On Oct 10, 12:58 am, jsdf jasons...@gmail.com wrote:
 On Oct 9, 10:30 am, Mark Murphy mmur...@commonsware.com wrote:

  jsdfwrote:
   Has anyone encountered this issue and corrected it?

  Have your client APK use the Uri directly, rather than through a public
  static data member in aclassthat is not in its APK.

  Or, use a common JAR that contains the CONTENT_URI definition, and
  reference that JAR from both APKs.

 Great, thanks.
 I appreciate the help, Mark.
 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
-~--~~~~--~~--~--~---



[android-developers] Re: VerifyError and Content Providers

2009-10-29 Thread Javen

Have you resolved it? and how
I have the same problem as yours.

On Oct 10, 12:58 am, jsdf jasons...@gmail.com wrote:
 On Oct 9, 10:30 am, Mark Murphy mmur...@commonsware.com wrote:

  jsdfwrote:
   Has anyone encountered this issue and corrected it?

  Have your client APK use the Uri directly, rather than through a public
  static data member in aclassthat is not in its APK.

  Or, use a common JAR that contains the CONTENT_URI definition, and
  reference that JAR from both APKs.

 Great, thanks.
 I appreciate the help, Mark.
 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
-~--~~~~--~~--~--~---



[android-developers] Re: VerifyError and Content Providers

2009-10-09 Thread jsdf

Does anyone have suggestions on this?
Has anyone encountered this issue and corrected it?
Thanks,
jsdf

On Oct 8, 3:17 pm, jsdf jasons...@gmail.com wrote:
 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
-~--~~~~--~~--~--~---



[android-developers] Re: VerifyError and Content Providers

2009-10-09 Thread Mark Murphy

jsdf wrote:
 Does anyone have suggestions on this?

Pretty much all VerifyErrors are build errors. In your case, I have no
idea how your code even compiles, considering that Constants.CONTENT_URI
is defined in one APK and is referenced in another APK, from your
description.

 Has anyone encountered this issue and corrected it?

Have your client APK use the Uri directly, rather than through a public
static data member in a class that is not in its APK.

Or, use a common JAR that contains the CONTENT_URI definition, and
reference that JAR from both APKs.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, $35/Year

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: VerifyError and Content Providers

2009-10-09 Thread jsdf



On Oct 9, 10:30 am, Mark Murphy mmur...@commonsware.com wrote:
 jsdfwrote:
  Has anyone encountered this issue and corrected it?

 Have your client APK use the Uri directly, rather than through a public
 static data member in a class that is not in its APK.

 Or, use a common JAR that contains the CONTENT_URI definition, and
 reference that JAR from both APKs.

Great, thanks.
I appreciate the help, Mark.
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
-~--~~~~--~~--~--~---