What's the minium version of Android required for Sqldroid?

205 views
Skip to first unread message

deegchr...@gmail.com

unread,
Jan 2, 2013, 11:12:40 PM1/2/13
to sqld...@googlegroups.com
Hello, I'm using the RC1 version of Sqldroid and I'm getting an error (see below).  I'm using Android 2.3.7 and I suspect that is too old.  I'm able to run my app on the latest version of Android.  Is there a minimum version required?  I am able to get a connection to the DB and run a few queries but then it fails.  Thanks for any help.

Error:

01-02 22:57:58.722: W/dalvikvm(2042): threadid=1: thread exiting with uncaught exception (group=0x40015560)
01-02 22:57:58.777: E/AndroidRuntime(2042): FATAL EXCEPTION: main
01-02 22:57:58.777: E/AndroidRuntime(2042): java.lang.NoSuchMethodError: android.database.Cursor.getType
01-02 22:57:58.777: E/AndroidRuntime(2042):     at org.sqldroid.SQLDroidResultSet.getObject(SQLDroidResultSet.java:430)
01-02 22:57:58.777: E/AndroidRuntime(2042):     at org.apache.commons.dbcp.DelegatingResultSet.getObject(DelegatingResultSet.java:325)
01-02 22:57:58.777: E/AndroidRuntime(2042):     at org.apache.commons.dbcp.DelegatingResultSet.getObject(DelegatingResultSet.java:325)
01-02 22:57:58.777: E/AndroidRuntime(2042):     at com.quinsoft.zeidon.dbhandler.JdbcHandler.getSqlObject(JdbcHandler.java:332)

Dave

unread,
Jan 3, 2013, 5:24:28 AM1/3/13
to sqld...@googlegroups.com
The culprit is that unnecessarily sdk api level 11 (android 3.0) constants are used
http://developer.android.com/reference/android/database/Cursor.html#FIELD_TYPE_BLOB
It should be int to lower the requirements.

  @Override
  public Object getObject(int colID) throws SQLException {
    lastColumnRead = colID;
    int newIndex = ci(colID);
    switch(c.getType(newIndex)) {
      case Cursor.FIELD_TYPE_BLOB:
        //CONVERT TO BYTE[] OBJECT
        return new SQLDroidBlob(c.getBlob(newIndex));
      case Cursor.FIELD_TYPE_FLOAT:
        return new Float(c.getFloat(newIndex));
      case Cursor.FIELD_TYPE_INTEGER:
        return new Integer(c.getInt(newIndex));
      case Cursor.FIELD_TYPE_STRING:
        return c.getString(newIndex);
      case Cursor.FIELD_TYPE_NULL:
        return null;
      default:
        return c.getString(newIndex);
    }
  }






Op donderdag 3 januari 2013 05:12:40 UTC+1 schreef deegchr...@gmail.com het volgende:

Dave

unread,
Jan 3, 2013, 5:29:11 AM1/3/13
to sqld...@googlegroups.com
And getType of course which is also sdk level 11 (android 3.0)
http://developer.android.com/reference/android/database/Cursor.html#getType%28int%29
Don't know why this is.


Op donderdag 3 januari 2013 11:24:28 UTC+1 schreef Dave het volgende:

deegchr...@gmail.com

unread,
Jan 3, 2013, 11:22:04 AM1/3/13
to sqld...@googlegroups.com
Thanks for the reply Dave.   Just so I'm clear, the minimum Android version for Sqldroid is 3.0?  Is there some code I can write to get around this?

Jim Redman

unread,
Jan 3, 2013, 11:53:11 AM1/3/13
to sqld...@googlegroups.com, Dave
The "getType" problem has been solved in SQLDroidResultSetMetaData -
calling the method by reflection if it exists. It needs the code from
there moved to SQLDroidResultSet.

Actually, I think it could be made static in one or the other of the
classes and reused.

Cursor.FIELD_TYPE_BLOB is resolved at compile time. There are a couple
of instances static finals that aren't available in 2.x so the code
cannot be compiled, but the final jar will run.

I don't have time to make this change immediately, anyone else have a
chance?

Sometime soon we should release an RC2. The compat jar that is out
there has some problems and also needs to be replaced, but I have to
check that the code is pulled into the main archive.

Jim
--
Jim Redman
(505) 662 5156 x85
http://www.ergotech.com

Jim Redman

unread,
Jan 3, 2013, 11:58:51 AM1/3/13
to sqld...@googlegroups.com
Deeg,

Sorry didn't see this until after the other response.

If you make the "getType" change suggested there and build under API 11+
the jar should then run under 2.x. If not, please drop a note with the
error.

Thanks,

Jim

deegchr...@gmail.com

unread,
Jan 3, 2013, 1:37:19 PM1/3/13
to sqld...@googlegroups.com, jre...@ergotech.com
Thanks Jim.  Since it looks like you guys have a handle on it I can wait for RC2 to come out.  I'll be happy to test it as soon as you release it.

Dave

unread,
Jan 3, 2013, 1:46:29 PM1/3/13
to sqld...@googlegroups.com, jre...@ergotech.com
It seems that it is fixed in the master so
if it is urgent then you can try:
git clone git://github.com/SQLDroid/SQLDroid.git
and then in the sqldroid directory do (you need ruby in your environment for that):
rake jar
and use the jar in the pkg directory in your project and see if it works.



Op donderdag 3 januari 2013 19:37:19 UTC+1 schreef deegchr...@gmail.com het volgende:

deegchr...@gmail.com

unread,
Jan 3, 2013, 8:10:48 PM1/3/13
to sqld...@googlegroups.com, jre...@ergotech.com
I cloned sqldroid, compiled it with rake, and used it in my project.  Unfortunately I got the exact same error.  I've verified that I'm using RC4 jar in my build.  The log is attached.
log.txt

Dave

unread,
Jan 4, 2013, 5:12:01 AM1/4/13
to sqld...@googlegroups.com, jre...@ergotech.com
It is better then to create an issue about it.

Op vrijdag 4 januari 2013 02:10:48 UTC+1 schreef deegchr...@gmail.com het volgende:

deegchr...@gmail.com

unread,
Jan 4, 2013, 10:56:23 AM1/4/13
to sqld...@googlegroups.com, jre...@ergotech.com

deegchr...@gmail.com

unread,
Mar 23, 2013, 10:45:07 PM3/23/13
to sqld...@googlegroups.com, jre...@ergotech.com
I can't comment in the issue so I'll post here: I can verify that RC9 appears to be working find on Android Vsn 2.3.7 (CyanogenMod 7).  Thanks for fixing!
Reply all
Reply to author
Forward
0 new messages