flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.13k stars 429 forks source link

ft.dropdown.Option content doesn't work as expected on Android #3616

Open PhunkyBob opened 3 months ago

PhunkyBob commented 3 months ago

Duplicate Check

Describe the bug

When I create a ft.Dropdown with a ft.dropdown.Option with the attribute content= in my page, it doesn't work on Android.

Code sample

Here is my `test.py` script: ```python import flet as ft def main(page: ft.Page): def button_clicked(e): t.value = f"Dropdown value is: {dd.value}" page.update() t = ft.Text() b = ft.ElevatedButton(text="Submit", on_click=button_clicked) dd = ft.Dropdown( width=100, options=[ ft.dropdown.Option(text="r", content=ft.Text("Red")), ft.dropdown.Option(text="g", content=ft.Text("Green")), ft.dropdown.Option(text="b", content=ft.Text("Blue")), ], ) page.add(dd, b, t) ft.app(target=main) ``` Here is the command line I used to create the APK file: ``` flet build apk --module-name test.py ```

To reproduce

  1. Create a file test.py with the previous content.
  2. Create an APK for Android plateform.
  3. Install on an Android device.
  4. Launch the app.

Expected behavior

When I run this code in Windows, it shows a dropdown with 3 choices ("Red", "Green", "Blue"). If I select one and submit, I see the key value in the page ("r", g" or "b").

I expect the same in Android.

Screenshots / Videos

Screenshots Result on Windows: ![image](https://github.com/flet-dev/flet/assets/13345603/266aecbc-6d38-4669-90e9-83272595dd33) Result on Android: Black empty screen.

Operating System

Windows

Operating system details

Windows 11 / Android 13

Flet version

0.23.2

Regression

I'm not sure / I don't know

Suggestions

I don't know how to view Python logs on the Android device. I suppose an exception occurs, because when I add debug traces, I don't see any after the creation of the ft.dropdown.Option element.

If I don't use content=ft.Text("..."), it works.

Logs

Logs How can I trace the logs in an Android device? With `adb logcat`: ```console 07-08 15:21:33.929 3909 4623 I iopgp : Iopgp: TRANSACTION_IOPGP_ON_KEY_DOWN sequence_id = 12 pkg_name = com.flet.tuto isProfile = 0 07-08 15:21:33.973 3909 4623 I iopgp : Iopgp: TRANSACTION_IOPGP_ON_INTENT_STARTED sequence_id = 12 pkg_name = com.flet.tuto class_name = com.flet.tuto.MainActivity 07-08 15:21:33.974 1761 9102 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.flet.tuto/.MainActivity bnds=[443,171][644,470] mCallingUid=10125} from uid 1012507-08 15:21:33.980 1761 9102 I OplusScreenSecurityMask: onStackAdded task = Task{1c65655 #3758 type=standard A=10448:com.flet.tuto U=0 visible=false visibleRequested=false mode=fullscreen translucent=true sz=0} record = null displayId = 0 07-08 15:21:33.983 1761 9102 D TaskFragmentExtImpl: add ActivityRecord{56c403f u0 com.flet.tuto/.MainActivity} t3758} to mActivityRecordSum = Counter{ com.flet.tuto/.MainActivity(1) } 07-08 15:21:33.984 1761 9102 D ActivityTaskManager: getStartingWindowType: newTask=true, taskSwitch=true, processRunning=false, allowTaskSnapshot=true, activityCreated=false, snapshot=null, record:ActivityRecord{56c403f u0 com.flet.tuto/.MainActivity} t3758} 07-08 15:21:33.984 1761 9102 D OplusZoomWindowRUSConfigManager: isSupportZoomModeWithPolicyLocked: target = com.flet.tuto/.MainActivity 07-08 15:21:33.984 1761 9102 D OplusZoomWindowRUSConfigManager: targetPkg = com.flet.tuto 07-08 15:21:33.991 3405 3618 D WindowManager: Add to mViews: android.widget.FrameLayout{9822847 V.E...... ......I. 0,0-0,0 viewInfo = },pkg= com.flet.tuto 07-08 15:21:33.991 1761 9102 D OplusAlwaysAliveManager: process not running, cold launch: ActivityRecord{56c403f u0 com.flet.tuto/.MainActivity} t3758}, processName: com.flet.tuto 07-08 15:21:33.991 1761 9102 D OplusUIFirst_FB: com.flet.tuto activity event: [] 07-08 15:21:33.994 1761 3393 D OplusFullScreenDisplayManager: adjustWindowParamsLw com.flet.tuto, no change cutoutMode: 1 07-08 15:21:33.996 1761 3393 I WindowManager: addWindow: New client android.os.BinderProxy@36bf837 : window=Window{c23a1a4 u0 Splash Screen com.flet.tuto} 07-08 15:21:34.003 1761 9102 I OplusHansManager : front pkg: com.flet.tuto, uid: 10448, prev pkg: com.android.launcher, prev uid: 10125 07-08 15:21:34.003 1761 3299 I Osense-DecisionMaker: notifySceneToAthenaPolicy: SCENE_APP_SWITCH, bundle: Bundle[{prevPkgName=com.android.launcher, curUid=10448, curPkgName=com.flet.tuto, prevUid=10125}] 07-08 15:21:34.004 1761 3687 I OplusResourcePreloadManager: resume pkg: com.flet.tuto, uid:10448, prev pkg: com.android.launcher, prev uid: 10125 07-08 15:21:34.007 1761 1890 I ActivityManager: Start proc 25336:com.flet.tuto/u0a448 for next-top-activity {com.flet.tuto/com.flet.tuto.MainActivity} 07-08 15:21:34.007 1761 9866 D OplusFullScreenDisplayManager: adjustWindowParamsLw com.flet.tuto, no change cutoutMode: 1 07-08 15:21:34.008 1761 9866 V WindowManager: Relayout Window{c23a1a4 u0 Splash Screen com.flet.tuto}: viewVisibility=0, oldvis=0, req=1080x2400 07-08 15:21:34.008 1761 9866 I WindowManager: Window{c23a1a4 u0 Splash Screen com.flet.tuto} state from NO_SURFACE to DRAW_PENDING; reason: resetDrawState 07-08 15:21:34.008 25336 25336 E com.flet.tuto: Unknown bits set in runtime_flags: 0x40000000 07-08 15:21:34.008 25336 25336 I com.flet.tuto: Using CollectorTypeCC GC. 07-08 15:21:34.010 25336 25336 E com.flet.tuto: Not starting debugger since process cannot load the jdwp agent. 07-08 15:21:34.012 1761 3393 D CoreBackPreview: Window{c23a1a4 u0 Splash Screen com.flet.tuto}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@1a6110e, mPriority=0} 07-08 15:21:34.013 1761 1890 D OplusUIFirst_FB: com.flet.tuto proc start: 10448 25336 false com.flet.tuto 07-08 15:21:34.013 1761 1890 D OplusUIFirst_FB: com.flet.tuto start process: [] 07-08 15:21:34.026 1761 9108 I WindowManager: Window{c23a1a4 u0 Splash Screen com.flet.tuto} state from DRAW_PENDING to COMMIT_DRAW_PENDING; reason: finishDrawingLocked 07-08 15:21:34.026 1761 9108 D WindowManager: finishDrawingLocked forceApplyNow=false,2,Window{c23a1a4 u0 Splash Screen com.flet.tuto} 07-08 15:21:34.027 1761 1867 I WindowManager: Window{c23a1a4 u0 Splash Screen com.flet.tuto} state from COMMIT_DRAW_PENDING to READY_TO_SHOW; reason: commitFinishDrawingLocked 07-08 15:21:34.032 1761 1867 I WindowManager: Window{c23a1a4 u0 Splash Screen com.flet.tuto} state from READY_TO_SHOW to HAS_DRAWN; reason: performShowLocked 07-08 15:21:34.033 1761 3918 I OplusHansManager : onUidActive() update stay time, uid=10448, pkgName=com.flet.tuto, U stay=14 07-08 15:21:34.034 1438 1438 D OplusLayer: (3264,Splash Screen com.flet.tuto#3264,com.android.systemui) setBuffer 07-08 15:21:34.035 1761 9866 D OplusUIFirst_FB: com.flet.tuto toForeOps: [] 07-08 15:21:34.040 1761 1867 I WindowStateExtImpl: onSurfaceShowChange show = true mPackageName = com.flet.tuto parentPkgName = com.flet.tuto 07-08 15:21:34.048 1761 9866 I OplusAppSwitchManagerService: appswitch hasProcess ActivityRecord{56c403f u0 com.flet.tuto/.MainActivity} t3758} 07-08 15:21:34.049 1761 9866 I OplusAppSwitchManagerService: appswitch hasProcess ActivityRecord{56c403f u0 com.flet.tuto/.MainActivity} t3758} 07-08 15:21:34.049 1761 9866 D OplusUIFirst_FB: com.flet.tuto activity event: [] 07-08 15:21:34.049 1761 9866 D OplusUIFirst_FB: handleParaSwitch com.flet.tuto null null 1 07-08 15:21:34.049 1761 9866 D ActivityTaskManager: onWindowFocusChanged Task{1c65655 #3758 type=standard A=10448:com.flet.tuto U=0 visible=true visibleRequested=true mode=fullscreen translucent=false sz=1} would transfer to compact 07-08 15:21:34.049 1761 4001 V DCSEX-AppSwitchManager: OnAppSwitchObserver: onAppExit, resuming = com.flet.tuto, target = com.android.launcher, is ResumingFirstStart = true, is ResumingMultiApp = false, extensionInfo = Bundle[{taskId=3758, uid=10448}] 07-08 15:21:34.049 1761 9866 I InputDispatcher: setFocusedApplication displayId=0 ActivityRecord{56c403f u0 com.flet.tuto/.MainActivity} t3758} 07-08 15:21:34.050 1761 15044 D DCSEX-AppLaunchEventRecorder: onAppSwitch from = com.android.launcher to = com.flet.tuto 07-08 15:21:34.051 1761 4001 D OplusAppSwitchListener: Detect com.flet.tuto switch to foreground 07-08 15:21:34.051 1761 4001 D OplusEapManager: mTargetEnterName :com.flet.tuto 07-08 15:21:34.051 1761 4001 D OplusLatencyOptimizerManager: enter pkg: com.flet.tuto isPrevBlackAppTop: false mIsBlackAppTop: false 07-08 15:21:34.052 1761 4001 V DCSEX-AppSwitchManager: OnAppSwitchObserver: onAppEnter, launchedFrom = com.android.launcher, target = com.flet.tuto, is firstStart = true, is multiApp = false, extensionInfo = Bundle[{taskId=3758, pid=25336, uid=10448, versionCode=1}] 07-08 15:21:34.052 1761 4001 D VRR [OPlusFrontAppManager]: OnAppSwitchObserver: onAppEnter , info.targetName = com.flet.tuto 07-08 15:21:34.052 1761 4001 D VRR [OPlusFrontAppManager]: packageName: com.flet.tuto 07-08 15:21:34.052 1761 1931 D VRR [OPlusRefreshRateService]: handleFrontAppChange pkgName: com.flet.tuto 07-08 15:21:34.052 1761 1931 D VRR [OPlusExternalRefreshRateManager]: setFrontPackageName pkgName: com.flet.tuto CurPkgName: null 07-08 15:21:34.052 9337 11469 W Battery : ThermalControlUtils: mForegroundPkg=com.flet.tuto 07-08 15:21:34.054 1761 1866 D OplusUIFirst_FB: com.flet.tuto moveToTop:[] 07-08 15:21:34.054 1761 1866 D OplusUIFirst_FB: com.flet.tuto boost hint: 25336 07-08 15:21:34.054 1761 1866 D OplusUIFirst_FB: handleParaSwitch com.flet.tuto null null 0 07-08 15:21:34.052 3788 3977 I Athena : AthenaDynamicReceiver: pre_app:com.android.launcher, next_app:com.flet.tuto(10448|25336) 07-08 15:21:34.056 1761 1866 D OplusKeepAliveManager: TOP_APP is ProcessRecord{4aa1136 25336:com.flet.tuto/u0a448} uid is 10448 07-08 15:21:34.058 1761 1866 D OplusUIFirst_FB: com.flet.tuto toForeOps: [] 07-08 15:21:34.068 25336 25336 D nativeloader: Configuring clns-4 for other apk /system_ext/framework/androidx.window.extensions.jar. target_sdk_version=34, uses_libraries=ALL, library_path=/data/app/~~sU5swCjxZP9G8UyP_tqvcA==/com.flet.tuto-xJn6UK_Be6ZLimICT8ThIA==/lib/arm64:/data/app/~~sU5swCjxZP9G8UyP_tqvcA==/com.flet.tuto-xJn6UK_Be6ZLimICT8ThIA==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.flet.tuto 07-08 15:21:34.070 25336 25336 D nativeloader: Configuring clns-5 for other apk /system_ext/framework/androidx.window.sidecar.jar. target_sdk_version=34, uses_libraries=ALL, library_path=/data/app/~~sU5swCjxZP9G8UyP_tqvcA==/com.flet.tuto-xJn6UK_Be6ZLimICT8ThIA==/lib/arm64:/data/app/~~sU5swCjxZP9G8UyP_tqvcA==/com.flet.tuto-xJn6UK_Be6ZLimICT8ThIA==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.flet.tuto 07-08 15:21:34.073 25336 25336 D nativeloader: Configuring clns-6 for other apk /data/app/~~sU5swCjxZP9G8UyP_tqvcA==/com.flet.tuto-xJn6UK_Be6ZLimICT8ThIA==/base.apk. target_sdk_version=34, uses_libraries=, library_path=/data/app/~~sU5swCjxZP9G8UyP_tqvcA==/com.flet.tuto-xJn6UK_Be6ZLimICT8ThIA==/lib/arm64:/data/app/~~sU5swCjxZP9G8UyP_tqvcA==/com.flet.tuto-xJn6UK_Be6ZLimICT8ThIA==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.flet.tuto 07-08 15:21:34.080 25336 25336 V GraphicsEnvironment: ANGLE Developer option for 'com.flet.tuto' set to: 'default' 07-08 15:21:34.080 25336 25336 V GraphicsEnvironment: ANGLE GameManagerService for com.flet.tuto: false 07-08 15:21:34.110 1761 9866 D OplusAppListInterceptManager: shouldFilterTask::packageName = com.flet.tuto 07-08 15:21:34.139 1761 9866 D SensorServiceExtImpl: isAllowOplusAMD opPackageName = com.flet.tuto 07-08 15:21:34.147 1438 4702 I SurfaceFlinger: [SF client] NEW(0xb400007da2027fc0) for (25336:com.flet.tuto) 07-08 15:21:34.171 1761 9102 E ScrollOptim [OplusPerfService]: isScrollOptimEnable: pkgName = com.flet.tuto, output = Bundle[{pre_anim_enable=true, frame_insert_list=null, frame_insert_default_num=1, scroll_changed_enable_list=null}] 07-08 15:21:34.171 25336 25336 D ScrollOptim [ConfigManager]: initOptConfig: pkg= com.flet.tuto, mOptEnable= true, mAnimAheadEnable= true, mInsertDefaultNum= 1, mFrameInsertEnableList= {}, mSCEnableList= [] 07-08 15:21:34.174 1438 4702 I SurfaceFlinger: [SF client] NEW(0xb400007da2027240) for (25336:com.flet.tuto) 07-08 15:21:34.175 25336 25336 D WindowManager: Add to mViews: DecorView@d5a61d2[MainActivity],pkg= com.flet.tuto 07-08 15:21:34.181 1761 9102 D OplusFullScreenDisplayManager: adjustWindowParamsLw com.flet.tuto, no change cutoutMode: 1 07-08 15:21:34.185 1761 9102 I WindowManager: addWindow: New client android.os.BinderProxy@ce7c37a : window=Window{699972b u0 com.flet.tuto/com.flet.tuto.MainActivity} 07-08 15:21:34.187 1761 9102 D CoreBackPreview: Window{699972b u0 com.flet.tuto/com.flet.tuto.MainActivity}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@d00f521, mPriority=0} 07-08 15:21:34.189 25336 25336 D ScrollOptim [SceneManager]: updateCurrentActivity: mCurrentActivityName=com.flet.tuto.MainActivity, isOptEnable=true, isAnimAheadEnable=true, isFrameInsertEnable=true, InsertNum=1, isEnabledForScrollChanged=false 07-08 15:21:34.200 1761 9107 D OplusFullScreenDisplayManager: adjustWindowParamsLw com.flet.tuto, no change cutoutMode: 1 07-08 15:21:34.200 1761 9107 V WindowManager: Relayout Window{699972b u0 com.flet.tuto/com.flet.tuto.MainActivity}: viewVisibility=0, oldvis=4, req=1080x2400 07-08 15:21:34.200 1761 9107 I WindowManager: Window{699972b u0 com.flet.tuto/com.flet.tuto.MainActivity} state from NO_SURFACE to DRAW_PENDING; reason: resetDrawState 07-08 15:21:34.204 1761 9107 V WindowManager: Changing focus from null to Window{699972b u0 com.flet.tuto/com.flet.tuto.MainActivity},diplayid=0 07-08 15:21:34.219 25336 26281 D BufferQueueProducer: [SurfaceView[com.flet.tuto/com.flet.tuto.MainActivity]#1(BLAST Consumer)1](id:62f800000001,api:1,p:25336,c:25336) connect: api=1 producerControlledByApp=true 07-08 15:21:34.224 1761 9107 D VRR [OPlusExternalRefreshRateManager]: isPkgTfcEnable: pkgName = com.flet.tuto, enable = false 07-08 15:21:34.224 1761 9107 D VRR [OPlusExternalRefreshRateManager]: getTfcMinFramerate: pkgName = com.flet.tuto, min framerate = 0 07-08 15:21:34.224 25336 25336 I DynamicFramerate [FRTCConfigManager]: FRTCConfigManager: FRTC_CAPABILITY = 120, package name = com.flet.tuto, PACKAGE_ENABLE = false 07-08 15:21:34.224 25336 25336 I DynamicFramerate [DynamicFrameRateController]: init info: mPackageName = com.flet.tuto, mIsEnabled = false 07-08 15:21:34.230 25336 25336 I Quality : Skipped: false 1 cost 30.381723 refreshRate 16632470 bit true processName com.flet.tuto 07-08 15:21:34.242 25336 26294 I flutter : programDirPath: /data/user/0/com.flet.tuto/app_flutter/tuto-1.0.0-1/app 07-08 15:21:34.250 1438 1438 D OplusLayer: (3277,SurfaceView[com.flet.tuto/com.flet.tuto.MainActivity](BLAST)#3277,com.flet.tuto) setBuffer 07-08 15:21:34.274 1761 9107 I WindowManager: Window{699972b u0 com.flet.tuto/com.flet.tuto.MainActivity} state from DRAW_PENDING to COMMIT_DRAW_PENDING; reason: finishDrawingLocked 07-08 15:21:34.274 1761 9107 D WindowManager: finishDrawingLocked forceApplyNow=false,2,Window{699972b u0 com.flet.tuto/com.flet.tuto.MainActivity} 07-08 15:21:34.276 1761 1867 I WindowManager: Window{699972b u0 com.flet.tuto/com.flet.tuto.MainActivity} state from COMMIT_DRAW_PENDING to READY_TO_SHOW; reason: commitFinishDrawingLocked 07-08 15:21:34.278 1761 1867 D OplusStartingWindowManager: interceptRemoveStartingWindow: packageName=com.flet.tuto, isSnapshot=false, startingSurfaceRunnable=null 07-08 15:21:34.283 1761 1867 I WindowManager: Window{699972b u0 com.flet.tuto/com.flet.tuto.MainActivity} state from READY_TO_SHOW to HAS_DRAWN; reason: performShowLocked 07-08 15:21:34.283 1438 1438 D OplusLayer: (3272,com.flet.tuto/com.flet.tuto.MainActivity#3272,com.flet.tuto) setBuffer 07-08 15:21:34.286 1761 1863 I Quality : LaunchTime2.0: com.flet.tuto/.MainActivity 1 291 com.android.launcher 52 70 12610 0 184119296 0 0 07-08 15:21:34.286 1761 1863 I ActivityTaskManager: Displayed com.flet.tuto/.MainActivity: +306ms 07-08 15:21:34.292 1761 1866 D OplusUIFirst_FB: com.flet.tuto moveToTop:[] 07-08 15:21:34.292 1761 1866 D OplusUIFirst_FB: com.flet.tuto boost hint: 25336 07-08 15:21:34.292 1761 1866 D OplusUIFirst_FB: handleParaSwitch com.flet.tuto null null 0 07-08 15:21:34.296 1761 1863 I ActivityTaskManager: Fully drawn com.flet.tuto/.MainActivity: +306ms 07-08 15:21:34.301 1761 1783 I FocusResolver: updateFocusedWindow, 699972b com.flet.tuto/com.flet.tuto.MainActivity on display 0, reason: Window became focusable. Previous reason: NOT_VISIBLE, result: FocusedWindows: 07-08 15:21:34.301 1761 1783 I FocusResolver: displayId=0, name='699972b com.flet.tuto/com.flet.tuto.MainActivity' 07-08 15:21:34.307 1761 9107 D InputMethodManagerService: isSecurity: attribute.packageName = com.flet.tuto mCurMethodId = com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME isSecurity = false ( enable = false needShow = false inBlackList = false isExist = true ) 07-08 15:21:34.314 9233 9233 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1986 onStartInput(EditorInfo{EditorInfo{packageName=com.flet.tuto, inputType=0, inputTypeString=NULL, enableLearning=false, autoCorrection=false, autoComplete=false, imeOptions=0, privateImeOptions=null, actionName=UNSPECIFIED, actionLabel=null, initialSelStart=-1, initialSelEnd=-1, initialCapsMode=0, label=null, fieldId=-1, fieldName=null, extras=Bundle[{com.oplus.im.SCENES=0}], hintText=null, hintLocales=[]}}, false) 07-08 15:21:34.323 1761 1783 I OplusAppSwitchManagerService: handleAppVisible , r = ActivityRecord{56c403f u0 com.flet.tuto/.MainActivity} t3758} 07-08 15:21:34.639 1761 9107 V WindowManager: Relayout Window{c23a1a4 u0 Splash Screen com.flet.tuto}: viewVisibility=8, oldvis=0, req=1080x2400 07-08 15:21:34.640 1761 9107 I SurfaceAnimationRunner: startAnimation requiresEdgeExtension=false, animationLeash=Surface(name=Surface(name=c23a1a4 Splash Screen com.flet.tuto)/@0x8bc89e8 - animation-leash of window_animation)/@0xbbb9801, runningAnim=com.android.server.wm.SurfaceAnimationRunner$RunningAnimation@8f636a6, mPreProcessingAnimations={} 07-08 15:21:34.644 3405 3618 D OplusScrollToTopManager: Splash Screen com.flet.tuto,window dying 07-08 15:21:34.644 3405 3618 D OplusScrollToTopManager: Splash Screen com.flet.tuto,unregisterSystemUIBroadcastReceiver 07-08 15:21:34.644 3405 3618 D OplusScrollToTopManager: Splash Screen com.flet.tuto, unregisterSystemUIBroadcastReceiver failed java.lang.IllegalArgumentException: Receiver not registered: android.view.OplusScrollToTopManager$2@5b4056a 07-08 15:21:34.644 1761 9107 D CoreBackPreview: Window{c23a1a4 u0 Splash Screen com.flet.tuto EXITING}: Setting back callback null 07-08 15:21:34.645 1761 1783 W InputManager-JNI: Input channel object 'c23a1a4 Splash Screen com.flet.tuto (client)' was disposed without first being removed with the input manager! 07-08 15:21:34.649 1438 1438 D Layer : reparent to null sequence=3279, seq[38], name=Surface(name=699972b com.flet.tuto/com.flet.tuto.MainActivity)/@0x552a11b - animation-leash of starting_reveal#3279 07-08 15:21:34.650 1761 1869 D SurfaceAnimationRunner: onAnimationStart:Surface(name=Surface(name=c23a1a4 Splash Screen com.flet.tuto)/@0x8bc89e8 - animation-leash of window_animation)/@0xbbb9801 07-08 15:21:34.799 1761 1869 D SurfaceAnimationRunner: onAnimationEnd:Surface(name=Surface(name=c23a1a4 Splash Screen com.flet.tuto)/@0x8bc89e8 - animation-leash of window_animation)/@0xbbb9801 07-08 15:21:34.799 1761 1867 I WindowStateExtImpl: onSurfaceShowChange show = false mPackageName = com.flet.tuto parentPkgName = com.flet.tuto 07-08 15:21:34.800 1761 1867 I WindowManager: Window{c23a1a4 u0 Splash Screen com.flet.tuto EXITING} state from HAS_DRAWN to NO_SURFACE; reason: destroySurface 07-08 15:21:34.815 1438 1438 D Layer : reparent to null sequence=3264, seq[5], name=Splash Screen com.flet.tuto#3264 07-08 15:21:34.816 1438 1438 D Layer : reparent to null sequence=3263, seq[3], name=c23a1a4 Splash Screen com.flet.tuto#3263 07-08 15:21:34.816 1438 1438 D Layer : reparent to null sequence=3281, seq[21], name=Surface(name=c23a1a4 Splash Screen com.flet.tuto)/@0x8bc89e8 - animation-leash of window_animation#3281 07-08 15:21:35.304 25336 25336 D OplusScrollToTopManager: com.flet.tuto/com.flet.tuto.MainActivity,This DecorView@d5a61d2[MainActivity] change focus to true 07-08 15:21:36.036 3667 15057 D AppStateRecord: getFgAppInStuckList: fgApp com.flet.tuto 07-08 15:21:39.066 9337 9891 D AppSwitchObserverHelper: packageName: com.flet.tuto,com.android.launcher ```

Additional details

If I run the application with flet run --android, it works as expected.

burhansvural commented 3 months ago

Have you looked at the CATlog data to understand what's going on.

PhunkyBob commented 3 months ago

Have you looked at the CATlog data to understand what's going on.

What is it? My main problem is that I don't know where to find the error log on an Android device.

EDIT: I found the "adb logcat" command, but nothing is obvious in this log. I've updated my initial post with the log.

ndonkoHenri commented 3 months ago

Option.content was introduced in 0.23.0, if not mistaken, so normally everything should work as expected if you are really making use of a version post-0.23.0. I gave it a try and it worked:

burhansvural commented 3 months ago

https://github.com/flet-dev/flet/assets/149883930/e4b39120-2fb8-4b8a-a8ce-b6bbfda168f3

PhunkyBob commented 3 months ago

Option.content was introduced in 0.23.0, if not mistaken, so normally everything should work as expected if you are really making use of a version post-0.23.0. I gave it a try and it worked:

I used 0.23.2 in a virtual environment.

(venv) λ flutter --version
Flutter 3.22.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 761747bfc5 (5 weeks ago) • 2024-06-05 22:15:13 +0200
Engine • revision edd8546116
Tools • Dart 3.4.3 • DevTools 2.34.3

(venv) λ flet --version
0.23.2

(venv) λ flet build apk --module-name test.py
[09:15:03] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.23.2 ✅
           Customized app icons and splash images ✅
[09:15:47] Generated app icons ✅
[09:16:05] Generated splash screens ✅
[09:17:11] Packaged Python app ✅
[09:25:25] Built .apk for Android ✅
           Copied build to build\apk directory ✅
[09:25:28] Successfully built your .apk for Android! � Find it in build\apk directory. �

If you can't reproduce, I don't understand what could be my problem :( Any clue?

@burhansvural , I can't see your video ("can't be played, file is corrupted").

burhansvural commented 3 months ago

install mpv player

PhunkyBob commented 3 months ago

I tried a clean install.

λ mkdir flet_bug
λ cd flet_bug\
λ python --version
Python 3.11.9

λ python -m venv venv
λ venv\Scripts\activate.bat
(venv) λ python -m pip install -U pip
(venv) λ python -m pip install flet
...
Installing collected packages: text-unidecode, pypng, websockets, watchdog, urllib3, ujson, typing-extensions, types-python-dateutil, sniffio, six, shellingham, pyyaml, python-slugify, python-multipart, python-dotenv, pygments, packaging, orjson, oauthlib, mdurl, MarkupSafe, idna, httptools, h11, dnspython, colorama, charset-normalizer, chardet, certifi, annotated-types, requests, repath, qrcode, python-dateutil, pydantic-core, markdown-it-py, Jinja2, httpcore, email_validator, click, binaryornot, anyio, watchfiles, uvicorn, starlette, rich, pydantic, httpx, flet-core, arrow, typer, flet-runtime, cookiecutter, fastapi-cli, fastapi, flet
Successfully installed Jinja2-3.1.4 MarkupSafe-2.1.5 annotated-types-0.7.0 anyio-4.4.0 arrow-1.3.0 binaryornot-0.4.4 certifi-2024.7.4 chardet-5.2.0 charset-normalizer-3.3.2 click-8.1.7 colorama-0.4.6 cookiecutter-2.6.0 dnspython-2.6.1 email_validator-2.2.0 fastapi-0.111.0 fastapi-cli-0.0.4 flet-0.23.2 flet-core-0.23.2 flet-runtime-0.23.2 h11-0.14.0 httpcore-1.0.5 httptools-0.6.1 httpx-0.27.0 idna-3.7 markdown-it-py-3.0.0 mdurl-0.1.2 oauthlib-3.2.2 orjson-3.10.6 packaging-23.2 pydantic-2.8.2 pydantic-core-2.20.1 pygments-2.18.0 pypng-0.20220715.0 python-dateutil-2.9.0.post0 python-dotenv-1.0.1 python-multipart-0.0.9 python-slugify-8.0.4 pyyaml-6.0.1 qrcode-7.4.2 repath-0.9.0 requests-2.32.3 rich-13.7.1 shellingham-1.5.4 six-1.16.0 sniffio-1.3.1 starlette-0.37.2 text-unidecode-1.3 typer-0.12.3 types-python-dateutil-2.9.0.20240316 typing-extensions-4.12.2 ujson-5.10.0 urllib3-2.2.2 uvicorn-0.30.1 watchdog-4.0.1 watchfiles-0.22.0 websockets-12.0

(venv) λ flet --version
0.23.2

(venv) λ flet create bug_demo
Done!

(venv) λ set JAVA_HOME=C:\Program Files\Java\jdk-17.0.3.1\

[edit the "main.py" file with my code]

(venv) λ cd bug_demo\
(venv) λ flet build apk
[09:44:05] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.23.2 ✅
           Customized app icons and splash images ✅
[09:44:18] Generated app icons ✅
[09:44:22] Generated splash screens ✅
[09:44:52] Packaged Python app ✅
[09:49:20] Built .apk for Android ✅
           Copied build to build\apk directory ✅
[09:49:27] Successfully built your .apk for Android! � Find it in build\apk directory. �

Here is the resulting APK: https://gofile.io/d/1lE0B2 I tried it on my phone and in an Android emulator ("system-images;android-34;google_apis;x86_64") : both failed.

2024-07-09_11-14-09

λ adb logcat | grep flet
07-09 09:03:29.981   557   620 V BackupManagerService: [UserID:0] restoreAtInstall pkg=com.flet.bug_demo token=1 restoreSet=0
07-09 09:04:15.057  1544  4623 I BlockstoreStorage: Clearing Blockstore Data for package com.flet.bug_demo [CONTEXT service_id=258 ]
07-09 09:04:58.426   557  1844 V SplashScreenExceptionList: SplashScreen checking exception for package com.flet.bug_demo (target sdk:34) -> false
07-09 09:04:58.485   906   948 V WindowManagerShell: Transition requested: android.os.BinderProxy@dc7dab9 TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=8 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.flet.bug_demo/.MainActivity } baseActivity=ComponentInfo{com.flet.bug_demo/com.flet.bug_demo.MainActivity} topActivity=ComponentInfo{com.flet.bug_demo/com.flet.bug_demo.MainActivity} origActivity=null realActivity=ComponentInfo{com.flet.bug_demo/com.flet.bug_demo.MainActivity} numActivities=1 lastActiveTime=293535 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{android.window.IWindowContainerToken$Stub$Proxy@6d2aefe} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 lastParentTaskIdBeforePip=-1 displayCutoutSafeInsets=null topActivityInfo=ActivityInfo{f7a165f com.flet.bug_demo.MainActivity} launchCookies=[android.os.BinderProxy@646a8ac] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isVisibleRequested=false isSleeping=false topActivityInSizeCompat=false topActivityEligibleForLetterboxEducation= false topActivityLetterboxed= false isFromDoubleTap= false topActivityLetterboxVerticalPosition= -1 topActivityLetterboxHorizontalPosition= -1 topActivityLetterboxWidth=-1 topActivityLetterboxHeight=-1 locusId=null displayAreaFeatureId=1 cameraCompatControlState=hidden}, remoteTransition = RemoteTransition { remoteTransition = android.window.IRemoteTransition$Stub$Proxy@4826975, appThread = android.app.IApplicationThread$Stub$Proxy@d26bd0a, debugName = QuickstepLaunch }, displayChange = null }
07-09 09:04:58.486   557  1844 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.flet.bug_demo/.MainActivity bnds=[465,1416][615,1585]} with LAUNCH_SINGLE_TOP from uid 10162 (BAL_ALLOW_ALLOWLISTED_COMPONENT) result code=0
07-09 09:04:58.510   557   598 I ActivityManager: Start proc 5219:com.flet.bug_demo/u0a190 for next-top-activity {com.flet.bug_demo/com.flet.bug_demo.MainActivity}
07-09 09:04:58.584  5219  5219 I m.flet.bug_demo: Using CollectorTypeCC GC.
07-09 09:04:58.586  5219  5219 W m.flet.bug_demo: Unexpected CPU variant for x86: x86_64.
07-09 09:04:58.586  5219  5219 W m.flet.bug_demo: Known variants: atom, sandybridge, silvermont, goldmont, goldmont-plus, tremont, kabylake, default
07-09 09:04:58.601  5219  5219 E m.flet.bug_demo: Not starting debugger since process cannot load the jdwp agent.
07-09 09:04:58.605   557  2413 D CoreBackPreview: Window{a1a4a6 u0 Splash Screen com.flet.bug_demo}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@1b36532, mPriority=0, mIsAnimationCallback=false}
07-09 09:04:58.899   557   585 V WindowManager: Sent Transition #8 createdAt=07-09 09:04:58.337 via request=TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=8 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.flet.bug_demo/.MainActivity } baseActivity=ComponentInfo{com.flet.bug_demo/com.flet.bug_demo.MainActivity} topActivity=ComponentInfo{com.flet.bug_demo/com.flet.bug_demo.MainActivity} origActivity=null realActivity=ComponentInfo{com.flet.bug_demo/com.flet.bug_demo.MainActivity} numActivities=1 lastActiveTime=293535 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{RemoteToken{fdb6971 Task{f3089f7 #8 type=standard A=10190:com.flet.bug_demo}}} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 lastParentTaskIdBeforePip=-1 displayCutoutSafeInsets=null topActivityInfo=ActivityInfo{8f28356 com.flet.bug_demo.MainActivity} launchCookies=[android.os.BinderProxy@dca4fd7] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isVisibleRequested=false isSleeping=false topActivityInSizeCompat=false topActivityEligibleForLetterboxEducation= false topActivityLetterboxed= false isFromDoubleTap= false topActivityLetterboxVerticalPosition= -1 topActivityLetterboxHorizontalPosition= -1 topActivityLetterboxWidth=-1 topActivityLetterboxHeight=-1 locusId=null displayAreaFeatureId=1 cameraCompatControlState=hidden}, remoteTransition = RemoteTransition { remoteTransition = android.window.IRemoteTransition$Stub$Proxy@ac1b0c4, appThread = android.app.IApplicationThread$Stub$Proxy@3ec2bad, debugName = QuickstepLaunch }, displayChange = null }
07-09 09:04:58.900   557   585 V WindowManager:     info={id=8 t=OPEN f=0x0 trk=0 r=[0@Point(0, 0)] c=[{WCT{RemoteToken{fdb6971 Task{f3089f7 #8 type=standard A=10190:com.flet.bug_demo}}} m=OPEN f=NONE leash=Surface(name=Task=8)/@0xdf8882c sb=Rect(0, 0 - 1080, 1920) eb=Rect(0, 0 - 1080, 1920) d=0},{WCT{RemoteToken{5ab7ee2 Task{68e19e9 #1 type=home}}} m=TO_BACK f=SHOW_WALLPAPER leash=Surface(name=Task=1)/@0x2bd52a3 sb=Rect(0, 0 - 1080, 1920) eb=Rect(0, 0 - 1080, 1920) d=0}]}
07-09 09:04:58.977  5219  5219 D nativeloader: Configuring clns-6 for other apk /data/app/~~h6FoYQu0CUj7eMCpjwM8Qw==/com.flet.bug_demo-Qr9GKcGJehQfu5znL_MFyw==/base.apk. target_sdk_version=34, uses_libraries=, library_path=/data/app/~~h6FoYQu0CUj7eMCpjwM8Qw==/com.flet.bug_demo-Qr9GKcGJehQfu5znL_MFyw==/lib/x86_64:/data/app/~~h6FoYQu0CUj7eMCpjwM8Qw==/com.flet.bug_demo-Qr9GKcGJehQfu5znL_MFyw==/base.apk!/lib/x86_64, permitted_path=/data:/mnt/expand:/data/user/0/com.flet.bug_demo
07-09 09:04:58.994  5219  5219 V GraphicsEnvironment: ANGLE GameManagerService for com.flet.bug_demo: false
07-09 09:04:58.994  5219  5219 V GraphicsEnvironment: com.flet.bug_demo is not listed in per-application setting
07-09 09:04:59.586  5219  5219 W m.flet.bug_demo: type=1400 audit(0.0:15): avc:  denied  { read } for  name="max_map_count" dev="proc" ino=59978 scontext=u:r:untrusted_app:s0:c190,c256,c512,c768 tcontext=u:object_r:proc_max_map_count:s0 tclass=file permissive=0 app=com.flet.bug_demo
07-09 09:05:00.154   557   582 D CoreBackPreview: Window{92e578 u0 com.flet.bug_demo/com.flet.bug_demo.MainActivity}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@81c1642, mPriority=0, mIsAnimationCallback=false}
07-09 09:05:01.466   557   585 I ActivityTaskManager: Displayed com.flet.bug_demo/.MainActivity for user 0: +3s182ms
07-09 09:05:01.469   557   585 I ActivityTaskManager: Fully drawn com.flet.bug_demo/.MainActivity: +3s182ms
07-09 09:05:01.504   557   582 I ImeTracker: com.flet.bug_demo:257980e: onRequestHide at ORIGIN_SERVER_HIDE_INPUT reason HIDE_UNSPECIFIED_WINDOW
07-09 09:05:01.506   557   582 I ImeTracker: com.flet.bug_demo:257980e: onCancelled at PHASE_SERVER_SHOULD_HIDE
07-09 09:05:01.746  1606  1606 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1877 onStartInput(EditorInfo{inputType=0x0(NULL) imeOptions=0x0 privateImeOptions=null actionName=UNSPECIFIED actionLabel=null actionId=0 initialSelStart=-1 initialSelEnd=-1 initialCapsMode=0x0 hintText=null label=null packageName=com.flet.bug_demo fieldId=0 fieldName=null extras=null}, false)
07-09 09:05:01.881   557  2413 W InputManager-JNI: Input channel object 'a1a4a6 Splash Screen com.flet.bug_demo (client)' was disposed without first being removed with the input manager!
07-09 09:05:01.899   557  1834 D CoreBackPreview: Window{a1a4a6 u0 Splash Screen com.flet.bug_demo EXITING}: Setting back callback null
07-09 09:05:08.257  5219  5293 I flutter : programDirPath: /data/user/0/com.flet.bug_demo/app_flutter/bug_demo-1.0.0-1/app
07-09 09:05:08.398  5219  5219 W DartWorker: type=1400 audit(0.0:16): avc:  granted  { execute } for  path="/data/data/com.flet.bug_demo/app_flutter/bug_demo-1.0.0-1/python_bundle/modules/zlib.cpython-311.so" dev="dm-40" ino=344550 scontext=u:r:untrusted_app:s0:c190,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c190,c256,c512,c768 tclass=file app=com.flet.bug_demo
07-09 09:05:08.546  5219  5219 W DartWorker: type=1400 audit(0.0:17): avc:  granted  { execute } for  path="/data/data/com.flet.bug_demo/app_flutter/bug_demo-1.0.0-1/python_bundle/modules/math.cpython-311.so" dev="dm-40" ino=344512 scontext=u:r:untrusted_app:s0:c190,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c190,c256,c512,c768 tclass=file app=com.flet.bug_demo
07-09 09:05:08.554  5219  5219 W DartWorker: type=1400 audit(0.0:18): avc:  granted  { execute } for  path="/data/data/com.flet.bug_demo/app_flutter/bug_demo-1.0.0-1/python_bundle/modules/_bisect.cpython-311.so" dev="dm-40" ino=344522 scontext=u:r:untrusted_app:s0:c190,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c190,c256,c512,c768 tclass=file app=com.flet.bug_demo
07-09 09:05:08.562  5219  5219 W DartWorker: type=1400 audit(0.0:19): avc:  granted  { execute } for  path="/data/data/com.flet.bug_demo/app_flutter/bug_demo-1.0.0-1/python_bundle/modules/_random.cpython-311.so" dev="dm-40" ino=344536 scontext=u:r:untrusted_app:s0:c190,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c190,c256,c512,c768 tclass=file app=com.flet.bug_demo
07-09 09:05:08.562  5219  5219 W DartWorker: type=1400 audit(0.0:20): avc:  granted  { execute } for  path="/data/data/com.flet.bug_demo/app_flutter/bug_demo-1.0.0-1/python_bundle/modules/_sha512.cpython-311.so" dev="dm-40" ino=344554 scontext=u:r:untrusted_app:s0:c190,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c190,c256,c512,c768 tclass=file app=com.flet.bug_demo
07-09 09:05:08.590  5219  5219 W DartWorker: type=1400 audit(0.0:21): avc:  granted  { execute } for  path="/data/data/com.flet.bug_demo/app_flutter/bug_demo-1.0.0-1/python_bundle/modules/_typing.cpython-311.so" dev="dm-40" ino=344521 scontext=u:r:untrusted_app:s0:c190,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c190,c256,c512,c768 tclass=file app=com.flet.bug_demo
burhansvural commented 3 months ago

Read this page https://flet.dev/docs/publish/android/

PhunkyBob commented 3 months ago

Read this page https://flet.dev/docs/publish/android/

Could you be more specific? Do you mean that I can't create an APK without p4a whereas I don't have any specific packages? Or that I have to use Python 3.11.6, not 3.11.9? Or Python 3.12?

EDIT: Python 3.12.4 -> also KO.

burhansvural commented 3 months ago

I'm use python 3.11 and 3.12 all packages, java= temurin-8.jdk, ndk=25.2.9519653 and API 33, cython=cython-3.0.10. I followed what was written on the page, respectively. I just used the "flet build apk" command.

PhunkyBob commented 3 months ago

@burhansvural what is your OS? I'm on Windows 11. How can you use temurin-8.jdk? When I use a version lower than 17, I have an error message saying that Gradle needs Java 17 at least.

PhunkyBob commented 3 months ago

OK, after a lots of tries and fails with several JDK (Temurin jdk8u412-b08, jdk-11.0.23+9, jdk-17.0.11+9, jdk-21.0.3+9), several NDK, and several computers (my personal and my professional computer), I'm giving up.

Since the rest of the application works as expected with my initial configuration, I'll avoid to use this component.