Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use SL4A on PyDroid #35

Open
GoogleCodeExporter opened this issue Apr 5, 2015 · 15 comments
Open

How to use SL4A on PyDroid #35

GoogleCodeExporter opened this issue Apr 5, 2015 · 15 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. İnstalled PyDroid on Android device (4.0)
2. Opened adb shell, and tryed to active RPC Launcher (whith this: 
https://code.google.com/p/android-python27/wiki/TutorialHowToRunPythonfromShell 
)

What is the expected output? What do you see instead?

PyDroid example's error is pyqt-error.txt:
Traceback (most recent call last):
  File "/data/data/org.kde.necessitas.example.PyDroid/files/main.py", line 35, in <module>
    main()
  File "/data/data/org.kde.necessitas.example.PyDroid/files/main.py", line 20, in main
    droid=android.Android()
  File "/data/data/org.kde.necessitas.example.PyDroid/files/python/lib/python2.7/android.py", line 34, in __init__
    self.conn = socket.create_connection(addr)
  File "/home/tsheasha/GUC/Bachelors/android-python27/python-build/build/lib/python2.7/socket.py", line 553, in create_connection
gaierror: [Errno 8] hostname nor servname provided, or not known.

What version of the product are you using? On what operating system?
Lubuntu 13.10

Please provide any additional information below.

How to active RPC server launcher and use SL4A on PyDroid?

Original issue reported on code.google.com by edips...@gmail.com on 25 Feb 2014 at 8:04

@GoogleCodeExporter
Copy link
Author

The PyDroid APK do not embed SL4A, some changes would be needed to add this 
feature.

Original comment by anthony....@gmail.com on 25 Feb 2014 at 10:47

@GoogleCodeExporter
Copy link
Author

If PyDroid APK could embed SL4A, it would be very useful like Kivy UI. Now Kivy 
uses Plyer instead of SL4A, so it is possible to create effective application 
with it. (https://github.com/kivy/plyer). Qt-QML is more stable and rich GUI 
than Kivy. So I though PyQt-PySide with SL4A would be better than Kivy. I hope 
PyDroid will embed SL4A or Plyer.

Thank you.

Original comment by edips...@gmail.com on 26 Feb 2014 at 9:17

@GoogleCodeExporter
Copy link
Author

I think it would not be complicated to add. Note that pyQT here is only QT4, 
with the new QT5 (Android support) this might be soon deprecated.

Original comment by anthony....@gmail.com on 26 Feb 2014 at 9:36

@GoogleCodeExporter
Copy link
Author

Fixed in 
https://code.google.com/p/android-python27/source/detail?r=be1f3ab3183765efbc640
544676d2b4f6c297b93

Original comment by anthony....@gmail.com on 27 Feb 2014 at 8:29

@GoogleCodeExporter
Copy link
Author

Thank you very much! I tryed to build the app according to Readme, changed 
/home/tsheasha/.. locations. Failed to build app because there are still many 
locations need be changed. Then I applied fixes on PySide example according to 
PySide Android tutorial, which uses Python27 for android project.( 
http://qt-project.org/wiki/PySide_for_Android_guide ), It built apk but app did 
not opened. I did not put "android/libs/armeabi/libPyDroid.so" file and did not 
edit main.h and PyDroid.pro paths (PySideExample.pro) for pyside-example 
project. I will try to edit python paths according to your project. If still 
does not work I will try to active GPS sensor using PyDroid project with Plyer 
(by Kivy). (https://github.com/raaron/pydroid and 
https://github.com/kivy/plyer) pyjnius and PySide can work with PyDroid. I 
tryed examples of this project and they work. Plyer is alternative of SL4A. I 
tested GPS example of this project using Kivy, and this actived GPS on device. 
I will try them. If one of them works, I will report here.

Regards

Original comment by edips...@gmail.com on 27 Feb 2014 at 11:04

@GoogleCodeExporter
Copy link
Author

You just need to import this project into eclipse: 
http://code.google.com/p/android-python27/source/browse/#hg%2Fpython-build-with-
qt%2FPyDroid%2Fandroid

And change your sdk path in local.properties (and have installed Android SDK 
api 17 or change project.properties to reflect your installed sdk api level)

Then the APK should build fine.

Original comment by anthony....@gmail.com on 27 Feb 2014 at 11:22

@GoogleCodeExporter
Copy link
Author

APK worked fine with SL4A. Thank you! :)

Original comment by edips...@gmail.com on 28 Feb 2014 at 1:13

@GoogleCodeExporter
Copy link
Author

When app is opened first time, It can works with SL4A. But when app is opened 
second time app can work without SL4A. Its error: 

Traceback (most recent call last):
  File "/data/data/org.kde.necessitas.example.PyDroid/files/main.py", line 31, in <module>
    droid = android.Android()
  File "/data/data/org.kde.necessitas.example.PyDroid/files/python/lib/python2.7/android.py", line 34, in __init__
    self.conn = socket.create_connection(addr)
  File "/home/tsheasha/GUC/Bachelors/android-python27/python-build/build/lib/python2.7/socket.py", line 553, in create_connection
gaierror: [Errno 8] hostname nor servname provided, or not known.

Original comment by edips...@gmail.com on 1 Mar 2014 at 9:59

@GoogleCodeExporter
Copy link
Author

[deleted comment]

1 similar comment
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

PythonAPK can work on device without problem. After running RPC launcher, then 
entering python paths on adb shell, it  runs SL4A script only once from 
terminal for PythonAPK. So it requires to run RPC launcher again for activating 
SL4A script. I could not run RPC launcher with PyDroid example, however reason 
of error may be activiting SL4A server while apk is running.

Original comment by edips...@gmail.com on 1 Mar 2014 at 10:22

@GoogleCodeExporter
Copy link
Author

I guess rather easy to fix.

Original comment by anthony....@gmail.com on 2 Mar 2014 at 7:47

@GoogleCodeExporter
Copy link
Author

Sorry. Those fixes kill your time, but I always try to fix them before I ask 
you. If PyQt-PySide can be used with SL4A, this can be alternative of Kivy. 
Just problem, size of APK is too much :)

Original comment by edips...@gmail.com on 2 Mar 2014 at 8:50

@GoogleCodeExporter
Copy link
Author

I applied your fix to PySide example project too. It worked with SL4A script at 
first installation, then it did not open. PySide example has Meego Harmattan 
QML components which can be easily created GUI, and can be used instead of Qt 
Quick 2.0.

Original comment by edips...@gmail.com on 3 Mar 2014 at 12:52

@GoogleCodeExporter
Copy link
Author

Also SL4A dialog scripts don't work with PyQt-PySide.  (tested get input and 
Bluetooth-chat example scripts)

Original comment by edips...@gmail.com on 4 Mar 2014 at 1:36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant