Skip to content

[apk packaging] - libpythonbundle.so': The file was not recognized as a valid object file #3580

@Jh-ony

Description

@Jh-ony

Duplicate Check

Describe the bug

When I run the flet build apk, it works and creates the file and it installs perfectly on the device (both physical and emulated)
Then i open it for the first time and it shows the content, but i open it a second time and it just closes
I open it again and it works, but then I open it again and it closes, and so on

almost in the end I get "The file was not recognized as a valid object file" but then it creates the apk

I'm not familiar with flet so don't know if I'm missing somenthing here

Code

No response

To reproduce

I run 'flet create ToDo'
then run the 'flet run' everything is normal, it shows the hello flet
then I paste the ToDo code in flet page
run it again and it works

But when I run 'flet build apk -v' for the verbose

PS D:\cff\flet\List> flet build apk -v
[14:14:10] Flutter bootstrap directory: C:\Users\Jhony\AppData\Local\Temp\flet_flutter_build_imubaAKjIx
Additional Flutter dependencies:
{}
[14:14:13] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.23.2 ✅
Copying D:\cff\flet\List\assets\icon.png to C:\Users\Jhony\AppData\Local\Temp\flet_flutter_build_imubaAKjIx\images
Customized app icons and splash images ✅
Run subprocess: ['C:\dev\flutter\bin\dart.BAT', 'run', 'flutter_launcher_icons']
( ● ) Generating app icons (3.2s)
( ●) Generating app icons ⏳...
Got dependencies in C:\Users\Jhony\AppData\Local\Temp\flet_flutter_build_imubaAKjIx.
( ● ) Generating app icons ⏳...
Built flutter_launcher_icons:flutter_launcher_icons.
( ● ) Generating app icons ⏳... ════════════════════════════════════════════
FLUTTER LAUNCHER ICONS (v0.13.1)
════════════════════════════════════════════

( ● ) Generating app icons ⏳... • Creating default icons Android
( ● ) Generating app icons ⏳... • Overwriting the default Android launcher icon with a new icon
( ● ) Generating app icons ⏳... • Overwriting default iOS launcher icon with new icon
( ● ) Generating app icons ⏳... Creating Icons for Web...
(● ) Generating app icons ⏳... Creating Icons for Windows...
( ● ) Generating app icons ⏳... Creating Icons for MacOS...
( ● ) Generating app icons ⏳...
✓ Successfully generated launcher icons
[14:14:22] Generated app icons ✅
Run subprocess: ['C:\dev\flutter\bin\dart.BAT', 'run', 'flutter_native_splash:create']
(● ) Generating splash screens ⏳...
Built flutter_native_splash:create.
( ● ) Generating splash screens ⏳... [Android] Creating default splash images
( ● ) Generating splash screens ⏳... [Android] Creating dark mode splash images
( ● ) Generating splash screens ⏳... [Android] Creating default android12splash images
(● ) Generating splash screens ⏳... [Android] Creating dark mode android12splash images
( ● ) Generating splash screens ⏳... [Android] Updating launch background(s) with splash image path...
[Android] - android/app/src/main/res/drawable/launch_background.xml
( ● ) Generating splash screens ⏳... [Android] - android/app/src/main/res/drawable-night/launch_background.xml
[Android] - android/app/src/main/res/drawable-v21/launch_background.xml
[Android] - android/app/src/main/res/drawable-night-v21/launch_background.xml
[Android] Updating styles...
[Android] - android/app/src/main/res/values-v31/styles.xml
[Android] No android/app/src/main/res/values-v31/styles.xml found in your Android project
[Android] Creating android/app/src/main/res/values-v31/styles.xml and adding it to your Android project
[Android] - android/app/src/main/res/values-night-v31/styles.xml
[Android] No android/app/src/main/res/values-night-v31/styles.xml found in your Android project
[Android] Creating android/app/src/main/res/values-night-v31/styles.xml and adding it to your Android project
[Android] - android/app/src/main/res/values/styles.xml
( ● ) Generating splash screens ⏳... [Android] - android/app/src/main/res/values-night/styles.xml
[iOS] Creating images
( ● ) Generating splash screens ⏳... [iOS] Creating dark mode images
( ● ) Generating splash screens ⏳... [iOS] Updating ios/Runner/Info.plist for status bar hidden/visible
( ●) Generating splash screens ⏳... [Web] Creating images
(● ) Generating splash screens ⏳... [Web] Creating images
( ● ) Generating splash screens ⏳... [Web] Creating background images
[Web] Creating CSS
[Web] Updating index.html

✅ Native splash complete.
Now go finish building something awesome! 💪 You rock! 🤘🤩
Like the package? Please give it a 👍 here: https://pub.dev/packages/flutter_native_splash

[14:14:28] Generated splash screens ✅
Run subprocess: ['C:\dev\flutter\bin\dart.BAT', 'run', 'serious_python:main', 'package', 'D:\cff\flet\List', '--mobile', '--platform', 'mobile',
'--dep-mappings', 'flet=flet-embed', '--req-deps', 'flet-embed', '--exclude', 'build']
( ● ) Packaging Python app ⏳...
Built serious_python:main.
( ● ) Packaging Python app ⏳... Running package command
Creating asset directory: C:\Users\Jhony\AppData\Local\Temp\flet_flutter_build_imubaAKjIx\app
Copying Python app from D:\cff\flet\List to C:\Users\Jhony\AppData\Local\Temp\serious_python_tempf84d4e81
( ● ) Packaging Python app ⏳... Configured mobile platform with sitecustomize.py at C:\Users\Jhony\AppData\Local\Temp\serious_python_sitecustomizea40de839\sitecustomize.py
Installing dependencies [flet-embed==0.22.*] with pip command to C:\Users\Jhony\AppData\Local\Temp\serious_python_tempf84d4e81_pypackages_
Extracting Python distributive from C:\Users\Jhony\AppData\Local\Temp\cpython-3.11.6+20231002-x86_64-pc-windows-msvc-shared-install_only.tar.gz to C:\Users\Jhony\AppData\Local\Temp\hostpython3.11_f7618b18
( ● ) Packaging Python app ⏳... Compiling Python sources at C:\Users\Jhony\AppData\Local\Temp\serious_python_tempf84d4e81
( ● ) Packaging Python app ⏳... Delete unnecessary files with extensions: [.py, .c, .h, .typed, .exe, .so, .a, .pdb, .pyd, .dll]
Delete unnecessary files and directories: [pycache, bin]
( ● ) Packaging Python app ⏳... Creating app archive at C:\Users\Jhony\AppData\Local\Temp\flet_flutter_build_imubaAKjIx\app/app.zip from C:\Users\Jhony\AppData\Local\Temp\serious_python_tempf84d4e81
( ● ) Packaging Python app ⏳... Deleting temp directory C:\Users\Jhony\AppData\Local\Temp\serious_python_tempf84d4e81
( ● ) Packaging Python app ⏳... Deleting sitecustomize directory C:\Users\Jhony\AppData\Local\Temp\serious_python_sitecustomizea40de839
Deleting Python directory C:\Users\Jhony\AppData\Local\Temp\hostpython3.11_f7618b18
[14:14:52] Packaged Python app ✅
Run subprocess: ['C:\dev\flutter\bin\flutter.BAT', 'build', 'apk']
( ● ) Building .apk for Android ⏳...
( ● ) Building .apk for Android ⏳...
( ● ) Building .apk for Android ⏳... collection 1.18.0 (1.19.0 available)
fl_chart 0.65.0 (0.68.0 available)
flutter_lints 2.0.3 (4.0.0 available)
flutter_markdown 0.6.23 (0.7.3 available)
http_parser 4.0.2 (4.1.0 available)
js 0.6.7 (0.7.1 available)
lints 2.1.1 (4.0.0 available)
material_color_utilities 0.8.0 (0.12.0 available)
meta 1.12.0 (1.15.0 available)
! package_info_plus 8.0.0 (overridden)
sensors_plus 4.0.2 (5.0.1 available)
! wakelock_plus 1.2.5 (overridden)
web_socket_channel 2.4.5 (3.0.0 available)
Got dependencies!
11 packages have newer versions incompatible with dependency constraints.
Try flutter pub outdated for more information.
( ● ) Building .apk for Android ⏳...
Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 257628 to 209160 bytes (18.8% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 1261080 bytes (23.3% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
C:/Users/Jhony/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe: error: 'C:\Users\Jhony\AppData\Local\Temp\flet_flutter_build_imubaAKjIx\build\serious_python_android\intermediates\merged_native_libs\release\mergeReleaseNativeLibs\out\lib\arm64-v8a\libpythonbundle.so': The file was not recognized as a valid object file

C:/Users/Jhony/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe: error: 'C:\Users\Jhony\AppData\Local\Temp\flet_flutter_build_imubaAKjIx\build\serious_python_android\intermediates\merged_native_libs\release\mergeReleaseNativeLibs\out\lib\armeabi-v7a\libpythonbundle.so': The file was not recognized as a valid object file

C:/Users/Jhony/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe: error: 'C:\Users\Jhony\AppData\Local\Temp\flet_flutter_build_imubaAKjIx\build\serious_python_android\intermediates\merged_native_libs\release\mergeReleaseNativeLibs\out\lib\x86_64\libpythonbundle.so': The file was not recognized as a valid object file

C:/Users/Jhony/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe: error: 'C:\Users\Jhony\AppData\Local\Temp\flet_flutter_build_imubaAKjIx\build\app\intermediates\merged_native_libs\release\mergeReleaseNativeLibs\out\lib\arm64-v8a\libpythonbundle.so': The file was not recognized as a valid object file

C:/Users/Jhony/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe: error: 'C:\Users\Jhony\AppData\Local\Temp\flet_flutter_build_imubaAKjIx\build\app\intermediates\merged_native_libs\release\mergeReleaseNativeLibs\out\lib\armeabi-v7a\libpythonbundle.so': The file was not recognized as a valid object file

C:/Users/Jhony/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe: error: 'C:\Users\Jhony\AppData\Local\Temp\flet_flutter_build_imubaAKjIx\build\app\intermediates\merged_native_libs\release\mergeReleaseNativeLibs\out\lib\x86_64\libpythonbundle.so': The file was not recognized as a valid object file

( ● ) Building .apk for Android ⏳... 240,3s
( ●) Building .apk for Android ⏳... √ Built build\app\outputs\flutter-apk\app-release.apk (63.2MB)
[14:18:59] Built .apk for Android ✅
Copying build output from: C:\Users\Jhony\AppData\Local\Temp\flet_flutter_build_imubaAKjIx\build\app\outputs\flutter-apk*
[14:19:00] Copied build to build\apk directory ✅
Deleting Flutter bootstrap directory C:\Users\Jhony\AppData\Local\Temp\flet_flutter_build_imubaAKjIx
[14:19:16] Successfully built your .apk for Android! 🥳 Find it in build\apk directory. 📂

  • And it goes as I said before.

Expected behavior

No response

Screenshots

No response

Operating System

Windows

Operating system details

Windows 11

Flet version

0.23.2

Regression

I'm not sure / I don't know

Suggestions

No response

Additional details

I've tried in an emulated device and in my own device, using a virtual enviroment too but it is the same

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions