Troubles with android build

Hello! I am really new to Panda3d.I was following documentation and created simple scene:
here is main.py code(currently using latest 1.11.0 dev build)

from direct.showbase.ShowBase import ShowBase
from math import pi, sin, cos
from direct.task import Task

class MyApp(ShowBase):

    def __init__(self):
        ShowBase.__init__(self)
        self.scene = self.loader.loadModel("models/environment")
        self.scene.reparentTo(self.render)
        self.scene.setScale(0.25, 0.25, 0.25)
        self.scene.setPos(-8, 42, 0)
        self.taskMgr.add(self.spinCameraTask, "SpinCameraTask")

        
    def spinCameraTask(self, task):
        angleDegrees = task.time * 6.0
        angleRadians = angleDegrees * (pi / 180.0)
        self.camera.setPos(20 * sin(angleRadians), -20 * cos(angleRadians), 3)
        self.camera.setHpr(angleDegrees, 0, 0)
        return Task.cont

        
app = MyApp()
app.run()

also i have setted up setup.py and requirements.txt for android builds:
Setup.py

from setuptools import setup

# Set renderer to pandagles2 (shaders) with pandagles (FFP) as fallback
PRC_DATA = '''
load-display pandagles2
aux-display pandagles

notify-level info
gl-debug true
'''

setup(
    name='Test',
    version='1.0.0',
    options={
        'build_apps': {
            # Uniquely identifies the app
            'application_id': 'com.uedev.test',

            # Update this for every version uploaded to the Play Store
            'android_version_code': 1,

            'gui_apps': {
                'test': 'main.py',
            },
            'plugins': [
                # Note use of pandagles2/pandagles instead of pandagl
                'pandagles2',
                'pandagles',
                'p3openal_audio',
            ],
            'include_patterns': [
                '**/*.png',
                '**/*.jpg',
                '**/*.egg',
            ],  
            'platforms': [
                'android',
            ],
            'extra_prc_data': PRC_DATA,

            'icons': {'*': 'logo.png'},
        },
    },
    # Choosing a classifier in the Games category makes it marked a "Game"
    classifiers=['Topic :: Games/Entertainment'],
)

after i put this command in terminal to build aab

python3 setup.py bdist_apps

I am getting an error

AssertionError: Extension .egg occurs in both file_handlers and bam_model_extensions!

Is there any fix? Thanks!

This error gone after i added -O to command:

python3 -O setup.py bdist_apps

Also i downloaded wheels from one of the posts on forum and putted path to requirements.txt and now i am getting error even if i have downloaded wheels for all platforms:

Missing panda3d wheel for platform: android_arm64

requirements.txt:

-f /Users/deniv/Documents/Wheels\

Welcome to the community.

I believe the original error has been fixed a while ago on the master branch of Panda3D, make sure you are using the latest version.

I am not sure why the wheels can’t be found. Maybe it has something to do with the \ at the end of the path. That should not be there. It could also be that you’re not running setup.py with Python 3.8. The wheels are built with Python 3.8, so you should run setup.py with Python 3.8 either.

Hello! Thank you for your response. I am using latest build avaliable for Mac and was trying to build with python 3.10. After i tried building with python 3.8 i am getting this error:


It is arguing on my setup.py.

I think your installation of Python 3.8 does not have a recent development build of Panda3D installed in it.

Yes there was no latest build. After installation of it i am still getting same error:

RuntimeError: Missing panda3d wheel for platform: android_arm64

Requirements.txt:

-f /Users/deniv/Documents/Wheels

Wheels folder:
Снимок экрана 2023-02-20 в 16.19.23
Which python version used to pack wheels? I installed release 3.8.0.

Erm, I am not sure. Can you show the full output and requirements.txt?

Python 3.8.0 is a very old release of Python 3.8. I recommend always getting the latest patch release. I recall there were some bugs with version tags very early on in the Python 3.8 release cycle, so maybe that is the problem.

Full output:

running bdist_apps
:Icon(warning): Image 'logo.png' could not be read
:Icon(warning): Cannot generate 256x256 icon; no higher resolution image available
:Icon(warning): Cannot generate 128x128 icon; no higher resolution image available
:Icon(warning): Cannot generate 48x48 icon; no higher resolution image available
:Icon(warning): Cannot generate 32x32 icon; no higher resolution image available
:Icon(warning): Cannot generate 16x16 icon; no higher resolution image available
running build_apps
:Icon(warning): Image 'logo.png' could not be read
:Icon(warning): Cannot generate 256x256 icon; no higher resolution image available
:Icon(warning): Cannot generate 128x128 icon; no higher resolution image available
:Icon(warning): Cannot generate 48x48 icon; no higher resolution image available
:Icon(warning): Cannot generate 32x32 icon; no higher resolution image available
:Icon(warning): Cannot generate 16x16 icon; no higher resolution image available
Building platforms: android
Gathering wheels for platform: android_arm64
Looking in indexes: https://pypi.org/simple, https://archive.panda3d.org/simple/opt, https://archive.panda3d.org/thirdparty
Looking in links: /Users/deniv/Documents/Wheels
Traceback (most recent call last):
  File "setup.py", line 12, in <module>
    setup(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 165, in setup
    return distutils.core.setup(**attrs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/direct/dist/commands.py", line 1725, in run
    self.run_command('build_apps')
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/direct/dist/commands.py", line 552, in run
    self.build_binaries(platform + suffix, lib_dir, data_dir)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/direct/dist/commands.py", line 814, in build_binaries
    raise RuntimeError("Missing panda3d wheel for platform: {}".format(platform))
RuntimeError: Missing panda3d wheel for platform: android_arm64

Requirements.txt

-f /Users/deniv/Documents/Wheels

(there was panda3d~=1.10.9 but i started getting error: ERROR: Could not find a version that satisfies the requirement panda3d~=1.10.9 (from -r /Users/deniv/Documents/DNVIDIA/requirements.txt (line 2)) (from versions: 1.11.0) so i removed it)

I installed latest python 3.8.10 release and getting same error

Addind ‘/’ to the end of wheels path fixed the issue:

-f /Users/deniv/Documents/Wheels/

I builded aab file. If someone will search up for this topic he might get this error:

TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

Solution:
1)Add to requirements.txt:

protobuf==3.20.*

2)before build command put this:

export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

Hope this will be helpfull!