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
10.83k stars 416 forks source link

build fail #3723

Closed imadityacoder closed 1 week ago

imadityacoder commented 1 month ago

Duplicate Check

Describe the bug

A problem occurred configuring project ':serious_python_android'.

[CXX1101] NDK at /home/aditya/development/Android/Sdk/ndk/25.1.8937393 did not have a source.properties file

Code sample

from flet import ( app, Page, ResponsiveRow, Container, Text, TextField, colors, Padding, Margin, Image, LinearGradient, Row, Column, animation, Divider, padding, FloatingActionButton, SnackBar, ) from time import sleep import requests

def main(page:Page): page.window.height = 740 page.window.width = 360 page.horizontal_alignment = "center" page.theme_mode = 'dark' page.bgcolor = 'black'

def show_weather(e):
    City = searchbox.value
    _api = f"https://api.openweathermap.org/data/2.5/weather?q={City}&appid=35d1f8809c55d6524936b21a958f9904"
    if searchbox.data == "true":
        if weatherbox.height == 0 :
            weatherbox.height = 700 * 0.6
            page.update()

        else:
            weatherbox.height = 700 * 0.0
            page.update()
            sleep(2)
            weatherbox.height = 700 * 0.6
            page.update()

    try:
        response = requests.get(_api)
        data = response.json()

        main = data['main']
        weather = data['weather'][0]

        _temp = main['temp']
        _desc = weather['description']
        _icon = weather['icon']
        _icon_url = f"http://openweathermap.org/img/wn/{_icon}@4x.png"
        _windspeed = data['wind']['speed']
        _humidity = main['humidity']
        _pressure = main['pressure']

        city.value = str(City)
        temp.value = str((int(_temp)-273.15//1))+"°C"
        desc.value = _desc
        weather_icon.src = _icon_url
        wspeed.value = f"{_windspeed}km/h"
        humid.value = f"{_humidity}%"
        pres.value = f"{_pressure}hPa"
        page.update()

    except Exception as E:
        city.value = "Not Found!"
        print(E)
        page.update()

    page.update()

searchbox = TextField(
    border_color=colors.LIGHT_BLUE_600,
    border_radius=18,
    color='white',
    border_width=2,
    text_align='center',
    suffix_icon='search',
    label="City",
    hint_text="e.g. New York",
    on_submit=lambda e:show_weather(e),
    data="true",

    )

city = Text(
        value="---- ----",
        weight="w500",
        color='white',
        size = 24,
        )

weather_icon = Image(src='cloudy.png',aspect_ratio=1)

temp = Text(
        value="--°C",
        weight="w400",
        color='white',
        size = 50,
)
desc = Text(
        value='--- ---',
        color='white70',
        weight='w400',
        size=16,
    )

wspeed = Text('-- km/h',size=20)

humid = Text('-- %',size=20)

pres = Text('-- hPa',size=20)

weather = Column(
        [
            city,
            Container(
                Row(
                    [
                        weather_icon,
                        Column(
                            [
                            Text(
                                value="Today",
                                weight="w300",
                                color='white',
                                size = 20,

                            ),
                            temp,
                            desc,

                            ],
                            horizontal_alignment='center',
                            alignment='center',
                            spacing=1,

                        ),

                    ],
                    alignment='center',
                ),

                width=240,
                height=120,

                margin=Margin(top=6,bottom=6,right=0,left=0)
            ),
            Divider(color='white',thickness=0.7,height=2),

            Container(

                height=100,
                width=340,
                content=Row(
                    vertical_alignment="center",
                    alignment="center",
                    spacing=32,
                    controls=[
                        Column(
                            [
                                Image(src='wind.png',height=38,width=38),
                                wspeed,
                                Text('wind',size=10),
                            ],
                            alignment='center',
                            horizontal_alignment='center',
                            spacing=1,

                        ),
                        Column(
                            [
                                Image(src='humidity.png',height=38,width=38),
                                humid,
                                Text('humidity',size=10),
                            ],
                            alignment='center',
                            horizontal_alignment='center',
                            spacing=1,
                        ),
                        Column(
                            [
                                Image(src='pressure.png',height=38,width=38),
                                pres,
                                Text('pressure',size=10),
                            ],
                            alignment='center',
                            horizontal_alignment='center',
                            spacing=1,
                        ),

                    ]
                )

            ),
            Container(
                Text("Powered by OpenWeatherMap",opacity=0.25),

            ),
            Container(
                Text("Created by Aditya",weight="w500",italic=True,color="black"),
                padding=padding.only(top=17),

            ),

        ],
        horizontal_alignment='center',

    )

weatherbox = Container(
    padding=Padding(top=5,left=10,right=10,bottom=20),
    margin=Margin(left=0,right=0,bottom=5,top=5),
    gradient=LinearGradient(colors=[colors.LIGHT_BLUE_400,colors.LIGHT_BLUE_600,colors.LIGHT_BLUE_800]),
    height= 700 * 0.6,
    border_radius=18,
    animate= animation.Animation(duration=500,curve='decelerate'),
    content=weather,

)
def fab_pressed(e):
    page.open(
        SnackBar(Text("This a project of Aditya ",color='white'), open=True ,duration=3000,bgcolor=colors.LIGHT_BLUE_600)
    )

page.floating_action_button = FloatingActionButton(
    icon='info', on_click=fab_pressed, bgcolor=colors.LIGHT_BLUE_900,mini=True,
)

page.add(
    ResponsiveRow(
        [
            searchbox,
            weatherbox,

        ],
        alignment="center"

    ),

)

page.update()

app(target=main,assets_dir='assets')

To reproduce

flet build apk --project "AdiWeather" --product "AdiWeather" -v

Expected behavior

No response

Screenshots / Videos

Screenshots / Video demonstration [Upload media here]

Operating System

Linux

Operating system details

Linux Mint 21.3 Cinnamon

Flet version

0.23.2

Regression

No, it isn't

Suggestions

No response

Logs

Logs ```console [12:55:21] Flutter bootstrap directory: /tmp/flet_flutter_build_a5CBokULjy Additional Flutter dependencies: {} [12:55:26] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.23.2 ✅ Copying /home/aditya/code playground/appcode/weather-app/assets/icon.png to /tmp/flet_flutter_build_a5CBokULjy/images Customized app icons and splash images ✅ Run subprocess: ['/home/aditya/development/flutter/bin/dart', 'run', 'flutter_launcher_icons'] ( ● ) Generating app icons ⏳... Resolving dependencies in `/tmp/flet_flutter_build_a5C( ● ) Generating app icons (6.8s) ( ●) Generating app icons ⏳... (1.0s) ( ● ) Generating app icons ⏳... Got dependencies in `/tmp/flet_flutter_build_a5CBokULjy`. ( ● ) Generating app icons (4.8s) 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 ⏳...done ( ● ) Generating app icons ⏳...done ( ● ) Generating app icons ⏳...done ✓ Successfully generated launcher icons [12:55:48] Generated app icons ✅ Run subprocess: ['/home/aditya/development/flutter/bin/dart', '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... ( ● ) Generating splash screens ⏳... [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 ( ● ) Generating splash screens ⏳... [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 [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 ( ● ) Generating splash screens ⏳... [Web] Updating index.html ( ● ) Generating splash screens ⏳... ✅ 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 [12:56:04] Generated splash screens ✅ Run subprocess: ['/home/aditya/development/flutter/bin/dart', 'run', 'serious_python:main', 'package', '/home/aditya/code playground/appcode/weather-app', '--mobile', '--platform', 'mobile', '--dep-mappings', 'flet=flet-embed', '--req-deps', 'flet-embed', '--exclude', 'build'] ( ● ) Packaging Python app (2.1s) Built serious_python:main. (● ) Packaging Python app ⏳... Running package command Creating asset directory: /tmp/flet_flutter_build_a5CBokULjy/app Copying Python app from /home/aditya/code playground/appcode/weather-app to /tmp/serious_python_tempFAEXPV ( ● ) Packaging Python app ⏳... Configured mobile platform with sitecustomize.py at /tmp/serious_python_sitecustomizeVCBQHT/sitecustomize.py Installing dependencies [flet-embed] with pip command to /tmp/serious_python_tempFAEXPV/__pypackages__ Extracting Python distributive from /tmp/cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz to /tmp/hostpython3.11_KVORSH ( ● ) Packaging Python app ⏳... Compiling Python sources at /tmp/serious_python_tempFAEXPV ( ● ) 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 /tmp/flet_flutter_build_a5CBokULjy/app/app.zip from /tmp/serious_python_tempFAEXPV ( ●) Packaging Python app ⏳... Deleting temp directory /tmp/serious_python_tempFAEXPV Deleting sitecustomize directory /tmp/serious_python_sitecustomizeVCBQHT Deleting Python directory /tmp/hostpython3.11_KVORSH [12:56:25] Packaged Python app ✅ Run subprocess: ['/home/aditya/development/flutter/bin/flutter', 'build', 'apk'] ( ● ) Building .apk for Android ⏳... (1.1s) ( ● ) 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) toml 0.15.0 (0.16.0 available) ! wakelock_plus 1.2.5 (overridden) web 0.5.1 (1.0.0 available) web_socket_channel 2.4.5 (3.0.1 available) Got dependencies! 13 packages have newer versions incompatible with dependency constraints. Try `flutter pub outdated` for more information. ( ● ) Building .apk for Android ⏳... ( ●) Building .apk for Android ⏳... Running Gradle task 'assembleRelease'... FAILURE: Build completed with 2 failures. 1: Task failed with an exception. ----------- * What went wrong: A problem occurred configuring project ':serious_python_android'. > [CXX1101] NDK at /home/aditya/development/Android/Sdk/ndk/25.1.8937393 did not have a source.properties file * 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. ============================================================================== 2: Task failed with an exception. ----------- * What went wrong: Failed to query the value of property 'buildFlowServiceProperty'. > Could not isolate value org.jetbrains.kotlin.gradle.plugin.statistics.BuildFlowService$Parameters_Decorated@68e008bf of type BuildFlowService.Parameters > A problem occurred configuring project ':serious_python_android'. > [CXX1101] NDK at /home/aditya/development/Android/Sdk/ndk/25.1.8937393 did not have a source.properties file * 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. ============================================================================== BUILD FAILED in 21s ( ● ) Building .apk for Androi 22.2s ( ● ) Building .apk for Android ⏳... Gradle task assembleRelease failed with exit code 1 [12:56:53] Deleting Flutter bootstrap directory /tmp/flet_flutter_build_a5CBokULjy Run subprocess: ['/home/aditya/development/flutter/bin/flutter', '--version'] [12:56:54] Error building Flet app - see the log of failed command above. ```

Additional details

No response

yst-one commented 1 month ago

+1

yst-one commented 1 month ago

Downloading packages...
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)
toml 0.15.0 (0.16.0 available)
! wakelock_plus 1.2.7 (overridden)
web 0.5.1 (1.0.0 available)
web_socket_channel 2.4.5 (3.0.1 available)
Got dependencies!
13 packages have newer versions incompatible with dependency constraints.
Try flutter pub outdated for more information.

       Running Gradle task 'assembleRelease'...                                                                                                                         
       Running Gradle task 'assembleRelease'...                           78.3s                                                                                         

       FAILURE: Build completed with 2 failures.                                                                                                                        

       1: Task failed with an exception.                                                                                                                                
       -----------                                                                                                                                                      
       * What went wrong:                                                                                                                                               
       A problem occurred configuring project ':serious_python_android'.                                                                                                
       > [CXX1101] NDK at C:\Users\Administrator\AppData\Local\Android\sdk\ndk\25.1.8937393 did not have a source.properties file                                       

       * 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.                                                                                                                      
       ==============================================================================                                                                                   

       2: Task failed with an exception.                                                                                                                                
       -----------                                                                                                                                                      
       * What went wrong:                                                                                                                                               
       Failed to query the value of property 'buildFlowServiceProperty'.                                                                                                
       > Could not isolate value org.jetbrains.kotlin.gradle.plugin.statistics.BuildFlowService$Parameters_Decorated@403eb38a of type BuildFlowService.Parameters       
          > A problem occurred configuring project ':serious_python_android'.                                                                                           
             > [CXX1101] NDK at C:\Users\Administrator\AppData\Local\Android\sdk\ndk\25.1.8937393 did not have a source.properties file                                 

       * 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.                                                                                                                      
       ==============================================================================                                                                                   

       BUILD FAILED in 1m 17s                                                                                                                                           
       Gradle task assembleRelease failed with exit code 1                                                                                                              

[11:03:36] Error building Flet app - see the log of failed command above.

ndonkoHenri commented 1 month ago

What is the output of flutter doctor?

imadityacoder commented 1 month ago

What is the output of flutter doctor? All done

ndonkoHenri commented 1 month ago

What do you mean @imadityacoder ?

imadityacoder commented 1 month ago

What do you mean @imadityacoder ?

I mean all requirements are done in flutter doctor and I also want to say that I already make some projects with flet and I also converted my apps into apk, linux and web . It occurs after updating flet from previous version.

imadityacoder commented 3 weeks ago

What is the output of flutter doctor?


[✓] Flutter (Channel stable, 3.22.3, on Linux Mint 21.3 5.15.0-113-generic, locale en_IN)
    • Flutter version 3.22.3 on channel stable at /home/aditya/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b0850beeb2 (4 weeks ago), 2024-07-16 21:43:41 -0700
    • Engine revision 235db911ba
    • Dart version 3.4.4
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/aditya/development/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/aditya/development/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 14.0.0-1ubuntu1.1
    • cmake version 3.22.1
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[✓] Android Studio (version 2023.1)
    • Android Studio at /home/aditya/development/android-studio
    • Flutter plugin version 78.2.1
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.91.0)
    • VS Code at /usr/share/code
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Linux Mint 21.3 5.15.0-113-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 126.0.6478.126

[✓] Network resources
    • All expected network resources are available.

• No issues found!
77suifla commented 2 weeks ago

I just stumbled on this issue: "felt build apk" failing with the error above while "flutter doctor" telling that everything is fine.

The problem turned out to be the ndk/25.1.8937393 being an almost empty directory. My new Android-Studio install had automatically downloaded the newest version of NDK 27.0.12077973 and not the required 25.1.8937393. Why there is also an almost empty directory for 25.1.8937393 I don't know.

The solution was to download version 25.1.8937393 of the NDK. For example using Android-Studio: "Tools", "SDK Manager", "SDK Tools", "Show Package Details", clicking on "NDK (Side by Side)", selecting 25.1.8937393 and then "Apply".

imadityacoder commented 1 week ago

I just stumbled on this issue: "felt build apk" failing with the error above while "flutter doctor" telling that everything is fine.

The problem turned out to be the ndk/25.1.8937393 being an almost empty directory. My new Android-Studio install had automatically downloaded the newest version of NDK 27.0.12077973 and not the required 25.1.8937393. Why there is also an almost empty directory for 25.1.8937393 I don't know.

The solution was to download version 25.1.8937393 of the NDK. For example using Android-Studio: "Tools", "SDK Manager", "SDK Tools", "Show Package Details", clicking on "NDK (Side by Side)", selecting 25.1.8937393 and then "Apply".

Thanks

imadityacoder commented 1 week ago

Thanks all of you for fix my problem.