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

decode JAVA_NAMESPACE in _android.pyx #1747

Merged
merged 1 commit into from
Mar 10, 2019
Merged

decode JAVA_NAMESPACE in _android.pyx #1747

merged 1 commit into from
Mar 10, 2019

Conversation

tshirtman
Copy link
Member

not sure why i need that if others don't, but i can't build anything depending on the android recipe without it.

@misl6
Copy link
Member

misl6 commented Mar 10, 2019

I'm also for that. (actually I'm patching it every time manually)
Never did a PR to fix it cause once I've read issue #1093, and I was overthinking that the problem was just mine.

Copy link
Member

@AndreMiras AndreMiras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!
It probably happens happens only on host python3 and pygame bootstrap, right?
https://github.com/kivy/python-for-android/blob/0.7.0/pythonforandroid/recipes/android/__init__.py#L51

@AndreMiras
Copy link
Member

FWIW a similar issue got addressed here #1475

@misl6
Copy link
Member

misl6 commented Mar 10, 2019

LGTM thanks!
It probably happens happens only on host python3 and pygame bootstrap, right?
https://github.com/kivy/python-for-android/blob/0.7.0/pythonforandroid/recipes/android/__init__.py#L51

@AndreMiras , also on python3+sdl2 ( for me )

@tshirtman
Copy link
Member Author

yeah, i'm pretty sure sdl2 is what's used in my build. And yeah i'm confused as well because the code for sdl2 for this declaration seems to make it an unicode string, but i still get the issue.

@tshirtman tshirtman merged commit be4c5b7 into master Mar 10, 2019
@tshirtman
Copy link
Member Author

merged, we'll see if that cause issues to others and learn more when that happens i guess.

@tshirtman tshirtman deleted the fix_android_pyx branch March 10, 2019 18:56
@idevo89
Copy link

idevo89 commented Mar 10, 2019

I gett an AttributeError after the change with python3

03-10 21:40:33.812 7532 7554 I python : File "android/_android.pyx", line 178, in init android._android
03-10 21:40:33.812 7532 7554 I python : AttributeError: 'str' object has no attribute 'decode'

@AndreMiras
Copy link
Member

Looks like we're gonna "learn more when that happens" soon 😄
So maybe it's time to dig into it further since it fixes for some people, but breaks for other.
@tshirtman could you trace on your side what happens there https://github.com/kivy/python-for-android/blob/0.7.0/pythonforandroid/recipes/android/__init__.py#L51
Because basically JAVA_NAMESPACE.decode('utf8') should only work if it's bytes on python3 correct? But from the code shared above we see it's not supposed to be bytes on sdl2 but str right?
So one thing I'm curious about is what code path makes your JAVA_NAMESPACE being a bytes.
Could you take a look? @misl6 can you also verify the same.
As for @idevo89 from what I see yes we definitely seemed to have overlooked it and your error given the current status is the one that definitely makes more sense on sdl2 and python3.

@tito
Copy link
Member

tito commented Mar 11, 2019

This is a very bad idea. If this is broken, you can expect many others stuff to be broken as well (anybody that actually does the same concatenation). if JAVA_NAMESPACE is bytes, then it's just wrong no?

I bet it's just about cython running with -3 or not

@gabrielbrise
Copy link

I'm stuck at this for the whole day, it doesn't seem to fix by changing the _android.pyx (both occurrences) that I found inside the /.buildozer that is created inside my project's folder.
What needs to be done other than changing the files and executing buildozer to compile a new apk? I was thinking maybe some cached stuff that was created when .decode was still there could cause it.

python : File "android/_android.pyx", line 178, in init android._android python : AttributeError: 'str' object has no attribute 'decode'

Yes, I am new to programming in general so I could have made a simple mistake or said some non-sense above.

@gabrielbrise
Copy link

I'm stuck at this for the whole day, it doesn't seem to fix by changing the _android.pyx (both occurrences) that I found inside the /.buildozer that is created inside my project's folder.
What needs to be done other than changing the files and executing buildozer to compile a new apk? I was thinking maybe some cached stuff that was created when .decode was still there could cause it.

python : File "android/_android.pyx", line 178, in init android._android python : AttributeError: 'str' object has no attribute 'decode'

Yes, I am new to programming in general so I could have made a simple mistake or said some non-sense above.

Just needed to use buildozer android clean
After that the fix worked and I was able to compile my first succesful apk!

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

Successfully merging this pull request may close these issues.

6 participants