How to use urllib in Android?

1,006 views
Skip to first unread message

Chen Yun

unread,
Feb 9, 2014, 9:24:26 AM2/9/14
to kivy-...@googlegroups.com
I pack this↓ to apk and run on my phone success. A Hello World with a button!
=================================================
import kivy
from kivy.app import App
from kivy.uix.button import Button

class MyApp(App):
    def build(self):
        return Button(text='Hello World')

if __name__ == '__main__':
    MyApp().run()
=================================================

because i want to use urllib.urlencode() so I import urllib and requirements = urllib,kivy
=================================================
import kivy
import urllib
from kivy.app import App
from kivy.uix.button import Button

class MyApp(App):
    def build(self):
        return Button(text='Hello World')

if __name__ == '__main__':
    MyApp().run()
=================================================
and pack ↑ this code again to apk ...
then in my phone  →  run this app  →  Kivy Loading  → unexpected quit !?

What happen!? I can't use it in Android? 
But work success on my pc before I pack this code? terminal:kivy main.py→It works!
Anyone knows something? thx

Gabriel Pettier

unread,
Feb 9, 2014, 12:19:44 PM2/9/14
to kivy-...@googlegroups.com
1/ urllib is a standard lib, no need to add it to requirements
2/ did you use adb logcat to check for errors on the device?

On Sun, Feb 09, 2014 at 06:24:26AM -0800, Chen Yun wrote:
> I pack this↓ to apk and run on my phone success. A Hello World with a
> button!
> =================================================
> import kivy
> from kivy.app import App
> from kivy.uix.button import Button
>
> class MyApp(App):
> def build(self):
> return Button(text='Hello World')
>
> if __name__ == '__main__':
> MyApp().run()
> =================================================
>
> because i want to use urllib.urlencode() so I import urllib and
> requirements = urllib,kivy
> =================================================
> import kivy
>
> *import urllib*from kivy.app import App
> from kivy.uix.button import Button
>
> class MyApp(App):
> def build(self):
> return Button(text='Hello World')
>
> if __name__ == '__main__':
> MyApp().run()
> =================================================
> and pack ↑ this code again to apk ...
> then in my phone → run this app → Kivy Loading → unexpected quit !?
>
> What happen!? I can't use it in Android?
> But work success on my pc before I pack this code? terminal:kivy main.py→It
> works!
> Anyone knows something? thx
>
> --
> 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.

Chen Yun

unread,
Feb 9, 2014, 1:16:43 PM2/9/14
to kivy-...@googlegroups.com
1) I take it out and try again,but same problem occur :(
2) I don't see any error occur...Is my step has any wrong?
    Here is my apk file click me
    
tshirtman於 2014年2月10日星期一UTC+8上午1時19分44秒寫道:

Gabriel Pettier

unread,
Feb 9, 2014, 7:08:25 PM2/9/14
to kivy-...@googlegroups.com
Error in logcat is:

I/python (26939): Traceback (most recent call last):
I/python (26939): File
"/Users/yunchen/Documents/kivy/examples/guide/quickstart/.buildozer/android/app/main.py",
line 2, in <module>
I/python (26939): File
"/Users/yunchen/Documents/kivy/examples/guide/quickstart/.buildozer/android/platform/python-for-android/dist/default/private/lib/python2.7/urllib.py",
line 1360, in <module>
I/python (26939): ImportError: No module named _scproxy

Not sure why it happens though, it seems to be an osx specific lib
(http://stackoverflow.com/questions/5647023/no-module-named-scproxy-on-osx)
so the issue could be triggered by a wrongful detection of dependency by
the build system… Sounds like a python-for-android bug.

On Sun, Feb 09, 2014 at 10:16:43AM -0800, Chen Yun wrote:
> 1) I take it out and try again,but same problem occur :(
> 2) I don't see any error occur...Is my step has any wrong?
> Here is my apk file click me<https://drive.google.com/file/d/0BywYIR8_97YmeXo2RHpqWVVsUWs/edit?usp=sharing>
> > an email to kivy-users+...@googlegroups.com <javascript:>.

Chen Yun

unread,
Feb 9, 2014, 7:10:37 PM2/9/14
to kivy-...@googlegroups.com

Got it! Thx for answer!

You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/s5xR4up5X98/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.

Travis N

unread,
Aug 16, 2015, 4:54:33 PM8/16/15
to Kivy users support
I'm also having the same problem with urllib..  was a solution ever found, or just a bug with no fix?

Thanks

niavlys

unread,
Aug 17, 2015, 2:03:04 AM8/17/15
to Kivy users support
it seems it had been fixed for a while:

https://github.com/kivy/python-for-android/issues/186

Chen Yun

unread,
Aug 17, 2015, 4:06:14 AM8/17/15
to kivy-...@googlegroups.com
Yeap, I update my kivy and everything work fine now :)

--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/s5xR4up5X98/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages