Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After installing my apk (on android-phone), I ran it, but it quit immediately. #4608

Open
1 task done
edwardcho opened this issue Dec 22, 2024 · 2 comments
Open
1 task done

Comments

@edwardcho
Copy link

Duplicate Check

Describe the bug

I succeed my app (apk).

Then I copied my-app (app-release.apk) to my android-phone.
Then installed my-app successfully.

Then clicked icon of my-app, but app was quit immediately.

What is the problem?

Code sample

Code
import matplotlib
import matplotlib.pyplot as plt
import numpy as np

import flet as ft
from flet.matplotlib_chart import MatplotlibChart

matplotlib.use("svg")

def main(page: ft.Page):

    # Fixing random state for reproducibility
    np.random.seed(19680801)

    dt = 0.01
    t = np.arange(0, 30, dt)
    nse1 = np.random.randn(len(t))  # white noise 1
    nse2 = np.random.randn(len(t))  # white noise 2

    # Two signals with a coherent part at 10Hz and a random part
    s1 = np.sin(2 * np.pi * 10 * t) + nse1
    s2 = np.sin(2 * np.pi * 10 * t) + nse2

    fig, axs = plt.subplots(2, 1)
    axs[0].plot(t, s1, t, s2)
    axs[0].set_xlim(0, 2)
    axs[0].set_xlabel("time")
    axs[0].set_ylabel("s1 and s2")
    axs[0].grid(True)

    cxy, f = axs[1].cohere(s1, s2, 256, 1.0 / dt)
    axs[1].set_ylabel("coherence")

    fig.tight_layout()
    
    chart = MatplotlibChart(fig, expand=True)

    #page.add(chart)
    
    def on_button_click(e):
    
        plt.cla()
        #plt.clf()
    
        # Fixing random state for reproducibility
        np.random.seed(23412)
        
        dt = 0.01
        t = np.arange(0, 30, dt)
        nse1 = np.random.randn(len(t))  # white noise 1
        nse2 = np.random.randn(len(t))  # white noise 2
        
        # Two signals with a coherent part at 10Hz and a random part
        s1 = np.sin(2 * np.pi * 10 * t) + nse1
        s2 = np.sin(2 * np.pi * 10 * t) + nse2
        
        fig, axs = plt.subplots(1, 1)
        #axs[0].plot(t, s1, t, s2)
        #axs[0].set_xlim(0, 2)
        #axs[0].set_xlabel("timesssss")
        #axs[0].set_ylabel("s2 and s1")
        #axs[0].grid(True)
        
        #cxy, f = axs[0].cohere(s1, s2, 256, 1.0 / dt)
        #axs[0].set_ylabel("coherence")

        cxy, f = axs.cohere(s1, s2, 256, 1.0 / dt)
        axs.set_ylabel("coherence")
       
        fig.tight_layout()  
    
        #chart.update()
        
        page.update()
    
    page.add(
        ft.ElevatedButton("Update Stock Chart", on_click=on_button_click),
        chart
    )    

ft.app(main)

To reproduce

  1. build my-app (flet build apk -vv)
  2. Copy apk-file to my android-phone.
  3. Installed my-app in android-phone.
  4. Click my-app.

Expected behavior

When clicked my-app on android-phone, app was quit immediately.

Screenshots / Videos

Captures

[Upload media here]

Operating System

macOS

Operating system details

Windows 10

Flet version

0.25.*

Regression

I'm not sure / I don't know

Suggestions

No response

Logs

Logs
[Paste your logs here]

Additional details

No response

@edwardcho edwardcho changed the title After installing my apk, I ran it, but it quit immediately. After installing my apk (on android-phone), I ran it, but it quit immediately. Dec 22, 2024
@youssef969
Copy link

what is your flutter version?

@edwardcho
Copy link
Author

My flutter version is 3.24.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants