After installing my apk (on android-phone), I ran it, but it quit immediately.
Duplicate Check
- [X] I have searched the opened issues and there are no duplicates
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
- build my-app (flet build apk -vv)
- Copy apk-file to my android-phone.
- Installed my-app in android-phone.
- 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
what is your flutter version?
My flutter version is 3.24.5.
Can you please try the latest release and let know if the issue still happens?
With one of the latest versions, add your dependencies to your pyproject.toml and it should normally work as expected.
dependencies = [
"flet",
"matplotlib",
]
Let know if you face additional issues.