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.39k stars 445 forks source link

path_provider_android:compileReleaseJavaWithJavac error: invalid source release: 22 #4005

Closed burhansvural closed 1 month ago

burhansvural commented 1 month ago

Duplicate Check

Describe the bug

When I use the flet build apk --include-packages flet_permission_handler command, the following error occurs: Execution failed for task ':path_provider_android:compileReleaseJavaWithJavac'.

error: invalid source release: 22

Code sample

Code ```python import flet as ft def main(page: ft.Page): page.scroll = ft.ScrollMode.ADAPTIVE page.appbar = ft.AppBar(title=ft.Text("PermissionHandler Tests")) ph = ft.PermissionHandler() page.overlay.append(ph) def check_permission(e): o = ph.check_permission(e.control.data) page.add(ft.Text(f"Checked {e.control.data.name}: {o}")) def request_permission(e): o = ph.request_permission(e.control.data) page.add(ft.Text(f"Requested {e.control.data.name}: {o}")) def open_app_settings(e): o = ph.open_app_settings() page.add(ft.Text(f"App Settings: {o}")) page.add( ft.OutlinedButton( "Check Contacts Permission", data=ft.PermissionType.CONTACTS, on_click=check_permission, ), ft.OutlinedButton( "Request Contacts Permission", data=ft.PermissionType.CONTACTS, on_click=request_permission, ), ft.OutlinedButton( "Open App Settings", on_click=open_app_settings, ), ) ft.app(main) ```

To reproduce

[23:41:20] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.24.1 ✅
Customized app icons and splash images ✅
[23:41:25] Generated app icons ✅
[23:41:28] Generated splash screens ✅
[23:41:49] Packaged Python app ✅
[23:43:36] Resolving dependencies...
Downloading packages...
collection 1.18.0 (1.19.0 available)
fl_chart 0.68.0 (0.69.0 available)
flutter_lints 2.0.3 (4.0.0 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.11.1 (0.12.0 available)
! package_info_plus 8.0.2 (overridden)
screen_retriever 0.1.9 (0.2.0 available)
sensors_plus 4.0.2 (6.0.1 available)
sensors_plus_platform_interface 1.2.0 (2.0.0 available)
toml 0.15.0 (0.16.0 available)
url_strategy 0.2.0 (0.3.0 available)
! wakelock_plus 1.2.8 (overridden)
! web 1.0.0 (overridden)
web_socket_channel 2.4.5 (3.0.1 available)
window_manager 0.3.9 (0.4.2 available)
Got dependencies!
14 packages have newer versions incompatible with dependency constraints.
Try flutter pub outdated for more information.

       Running Gradle task 'assembleRelease'...                                                                                                                                    
       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.                                                                                                                          
       Running Gradle task 'assembleRelease'...                          103,8s                                                                                                    

       Warning: SDK processing. This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions of    
       Android Studio and the command-line tools that were released at different times.                                                                                            

       FAILURE: Build failed with an exception.                                                                                                                                    

       * What went wrong:                                                                                                                                                          
       Execution failed for task ':path_provider_android:compileReleaseJavaWithJavac'.                                                                                             
       > error: invalid source release: 22                                                                                                                                         

       * Try:                                                                                                                                                                      
       > Run with --stacktrace option to get the stack trace.                                                                                                                      
       > Run with --info or --debug option to get more log output.                                                                                                                 
       > Run with --scan to get full insights.                                                                                                                                     
       > Get more help at https://help.gradle.org.                                                                                                                                 

       BUİLD FAILED in 1m 43s                                                                                                                                                      
       Gradle task assembleRelease failed with exit code 1                                                                                                                         

       Error building Flet app - see the log of failed command above.                                                                                                              

[23:43:40] Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on Pardus GNU/Linux 23 (yirmiuc) 6.1.0-21-amd64, locale tr_TR.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc2)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2024.1)
[✓] Android Studio (version 2024.1)
[✓] IntelliJ IDEA Community Edition (version 2024.2)
[✓] VS Code (version 1.93.1)
[✓] Connected device (2 available)
[✓] Network resources

       • No issues found!  

Expected behavior

No response

Screenshots / Videos

Captures ![Ekran görüntüsü_2024-09-17_23-54-40](https://github.com/user-attachments/assets/8d163c18-8cbf-4e20-925a-2f30129da06e)

Operating System

Linux

Operating system details

Debian 12

Flet version

0.24.1

Regression

Yes, it used to work in a previous Flet version (please specify the version in additional details)

Suggestions

No response

Logs

Logs ```console [23:41:20] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.24.1 ✅ Customized app icons and splash images ✅ [23:41:25] Generated app icons ✅ [23:41:28] Generated splash screens ✅ [23:41:49] Packaged Python app ✅ [23:43:36] Resolving dependencies... Downloading packages... collection 1.18.0 (1.19.0 available) fl_chart 0.68.0 (0.69.0 available) flutter_lints 2.0.3 (4.0.0 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.11.1 (0.12.0 available) ! package_info_plus 8.0.2 (overridden) screen_retriever 0.1.9 (0.2.0 available) sensors_plus 4.0.2 (6.0.1 available) sensors_plus_platform_interface 1.2.0 (2.0.0 available) toml 0.15.0 (0.16.0 available) url_strategy 0.2.0 (0.3.0 available) ! wakelock_plus 1.2.8 (overridden) ! web 1.0.0 (overridden) web_socket_channel 2.4.5 (3.0.1 available) window_manager 0.3.9 (0.4.2 available) Got dependencies! 14 packages have newer versions incompatible with dependency constraints. Try `flutter pub outdated` for more information. Running Gradle task 'assembleRelease'... 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. Running Gradle task 'assembleRelease'... 103,8s Warning: SDK processing. This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times. FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':path_provider_android:compileReleaseJavaWithJavac'. > error: invalid source release: 22 * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUİLD FAILED in 1m 43s Gradle task assembleRelease failed with exit code 1 Error building Flet app - see the log of failed command above. [23:43:40] Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.24.3, on Pardus GNU/Linux 23 (yirmiuc) 6.1.0-21-amd64, locale tr_TR.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc2) [✓] Chrome - develop for the web [✓] Linux toolchain - develop for Linux desktop [✓] Android Studio (version 2024.1) [✓] Android Studio (version 2024.1) [✓] IntelliJ IDEA Community Edition (version 2024.2) [✓] VS Code (version 1.93.1) [✓] Connected device (2 available) [✓] Network resources • No issues found! ```

Additional details

No response

burhansvural commented 1 month ago

I'm so sorry, I forgot that I was using java 22. It was fixed when I set the java version to 1.8.