Skip to content

Gradlew._path seems to be a regular string #3104

Description

@chemelnucfin

Checklist

  • the issue is indeed a bug and not a support request
  • issue doesn't already exist: https://github.com/kivy/python-for-android/issues
  • I have a short, runnable example that reproduces the issue
  • I reproduced the problem with the latest development version (p4a.branch = develop)
  • I used the grave accent (aka backticks) to format code or logs when appropriated

Versions

  • Python: 3.13.1
  • OS: Fedora 41
  • Kivy: 2.3.1
  • Cython: 3.0.11
  • OpenJDK: 23.0.1.0.11

Description

Ran buildozer android debug

Got an AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'? regarding gradlew._path being str.

 [INFO]:    Detected highest available build tools version to be 34.0.0
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1257, in <module>
    main()
    ~~~~^^
  File "/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
    ~~~~~~~~~~~^^
  File "/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 685, in __init__
    getattr(self, command)(args)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 105, in wrapper_func
    func(self, args, **kw)
    ~~~~^^^^^^^^^^^^^^^^^^
  File "/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1119, in apk
    output, build_args = self._build_package(args, package_type='apk')
                         ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1037, in _build_package
    sh.Command('dos2unix'), gradlew._path.decode('utf8'),
                            ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?

Replaced /.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py line 1037 with this and it seemed to work -

                try:
                    output = shprint(
                        sh.Command('dos2unix'), gradlew._path.decode('utf8'),
                        _tail=20, _critical=True, _env=env
                    )
                except AttributeError:
                    output = shprint(
                        sh.Command('dos2unix'), gradlew._path,
                        _tail=20, _critical=True, _env=env
                    )

It follows with some gradle errors. Doesn't seem related, but will need more investigation at a separate time.

> Task :compressDebugAssets FAILED
[DEBUG]:   	
[DEBUG]:   	FAILURE: Build failed with an exception.
[DEBUG]:   	
[DEBUG]:   	* What went wrong:
[DEBUG]:   	Execution failed for task ':compressDebugAssets'.
[DEBUG]:   	> A failure occurred while executing com.android.build.gradle.internal.tasks.CompressAssetsWorkAction
[DEBUG]:   	   > Java heap space

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions