Debug Android Applications

547 views
Skip to first unread message

Wenshan

unread,
Jul 5, 2013, 2:30:33 AM7/5/13
to kivy-...@googlegroups.com
Hi,

I have a toy Kivy program that runs well on Ubuntu, however, once built on Android it crashes at some point ant the logcat gives:

I/python  ( 4772):    File "/home/wenshan/login/main.py", line 49, in onclick_save
I
/python  ( 4772):  sqlite3.OperationalError: near ",": syntax error
I
/python  ( 4772): Python for android ended.


I am confused by this because the program works on Ubuntu and it also works on Android if I replace line #49 with a simple SQL write statement (excludes Android permission problem).

Anyway, I want to know the way to debug (logs, break points, etc.) Kivy programs on Android, any recommendation?



Regards, 

Akshay Arora

unread,
Jul 7, 2013, 3:25:59 AM7/7/13
to kivy-...@googlegroups.com
Use Logger.debug("topic: error string") to get a log output like that of kivy, for checking individual commands I'd recommend http://github.com/kivy/kivy-remote-shell


--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Wenshan

unread,
Jul 8, 2013, 1:41:25 AM7/8/13
to kivy-...@googlegroups.com
It works, thank you.

However, after building on Android, I got the following error message:

I/python  ( 4624):  Traceback (most recent call last):
I
/python  ( 4624):    File "/home/openerp/code/python-for-android/build/python-install/lib/python2.7/logging/__init__.py", line 865, in emit
I
/python  ( 4624):    File "<string>", line 15, in write
I
/python  ( 4624):  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 552: ordinal not in range(128)


While it worked well on Ubuntu.

This isn't the original question anymore, but please give some hints if you have met with this problem before.


Thanks,


在 2013年7月7日星期日UTC+10下午5时25分59秒,qua-non写道:

Akshay Arora

unread,
Jul 8, 2013, 2:26:54 AM7/8/13
to kivy-...@googlegroups.com
We can't make any heads or tails with just the error without looking at your code

Wenshan

unread,
Jul 8, 2013, 7:45:48 PM7/8/13
to kivy-...@googlegroups.com
The related code is :

        Logger.info(",".join(listview.item_strings))

Where listview.item_strings is a list of strings, and on Ubuntu it outputs:

[INFO   ] Administrator,Agrolait,Michel Fletcher,Thomas Passot,ASUSTeK,Joseph Walters,Tang Tsui,Axelor,Laith Jubair,Bank Wealthy and sons,Charlie Bernard,Jessica Dupont,Best Designers,Ayaan Agarwal,Camptocamp,Luc Maurer,Chamber Works,Angel Cook,Robert Anderson,China Export,Chao Wang,Zhi Chang,Delta PC,Brian Williams,Paul Williams,Richard Ellis,Demo Portal User,Demo User,Elec Import,James Miller,Epic Technologies,David Simpson,John M. Brown,Global Solutions,Kevin Clarke,Morgan Rose,Robin Smith,Luminous Technologies,Laura Castro,Sergio Pérez,Mediapole,Phillipp Miller,Millennium Industries,Jacob Taylor,Nebula Business,Benjamin Flores,Seagate,Edward Foster,Spark Systems,Arthur Gomez,Julia Rivero,Template User,The Jackson Group,Daniel Jackson,William Thomas,Think Big Systems,George Wilson,Lucas Jones,Vauxoo,Nhomar Hernandez,Vicking Direct,Peter Mitchell,Wenshan,Your Company,Mark Davis,Roger Scott


Thanks,


在 2013年7月8日星期一UTC+10下午4时26分54秒,qua-non写道:

Akshay Arora

unread,
Jul 9, 2013, 1:38:49 PM7/9/13
to kivy-...@googlegroups.com
Did you try

        Logger.info(u",".join(listview.item_strings))

it is upto you to make your app unicode safe.

Regards

ZenCODE

unread,
Jul 10, 2013, 4:59:11 AM7/10/13
to kivy-...@googlegroups.com
Another 2c. If you're going to be dealing with unicode strings, try encoding them in UTF-8. We has similar issues with sqlite, something like this fixed it:

        sql = u"INSERT INTO scores values (?, ?, ?, ?, ?, ?, ?)"\
            .encode("utf-8")
        with sqlite.connect(self.stuDBName) as conn:
            conn.execute(sql,
                      (username.decode("utf-8"),
                       assess_item.decode("utf-8"),
                       display_item.decode("utf-8"),
                       measurement_id, False, mode, "-"))

A google search on your error will tell you more...
Reply all
Reply to author
Forward
0 new messages