Open ateshkoul opened 1 day ago
from android.content import Intent
That should work fine, so my guess is that isn't actually the code that's producing the exception.
-u
to the briefcase run
command line, as explained here?If neither of those work, please post at least the first 33 lines of app.py.
I tried both checks as well as verified the same error on android emulator as well. Here are the first 33 lines of app.py:
""" app for music """
import toga from toga.style import Pack from toga.style.pack import COLUMN, ROW import os import pdb import json import asyncio import numpy as np import random import spotipy from walkman.eye_tracker.device import Device,StatusUpdateNotifier from walkman.eye_tracker.models import Recording from walkman.eye_tracker.discovery import Network from datetime import datetime,timedelta from meteostat import Point, Hourly
from walkman.spotify_class import walkman_spotify import time
from toga.platform import get_current_platform
if not get_current_platform() == 'windows': from java import jclass from android.content import Intent (this is the line 33)
Thanks a lot!
Describe the bug
While building and running the app for an android phone, I am trying to get sensor data. From the documentation, I am trying to import the android intents. However, during the execution of the app, I receive the error "ModuleNotFoundError: No module named 'android'".
Steps to reproduce
Expected behavior
import of the android module
Screenshots
No response
Environment
Logs
←[31mE/AndroidRuntime: FATAL EXCEPTION: main←[0m ←[31mE/AndroidRuntime: Process: com.example.walkman, PID: 1399←[0m ←[31mE/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.walkman/org.beeware.android.MainActivity}: com.chaquo.python.PyException: ModuleNotFoundError: No module named 'android'←[0m ←[31mE/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3781)←[0m ←[31mE/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3943)←[0m ←[31mE/AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)←[0m ←[31mE/AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)←[0m ←[31mE/AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)←[0m ←[31mE/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2348)←[0m ←[31mE/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)←[0m ←[31mE/AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:233)←[0m ←[31mE/AndroidRuntime: at android.os.Looper.loop(Looper.java:344)←[0m ←[31mE/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8191)←[0m ←[31mE/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)←[0m ←[31mE/AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)←[0m ←[31mE/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)←[0m ←[31mE/AndroidRuntime: Caused by: com.chaquo.python.PyException: ModuleNotFoundError: No module named 'android'←[0m ←[31mE/AndroidRuntime: at.walkman.app.(app.py:33)←[0m
←[31mE/AndroidRuntime: at .java.chaquopy.import_override(import.pxi:60)←[0m
←[31mE/AndroidRuntime: at .main.(main.py:1)←[0m
←[31mE/AndroidRuntime: at .runpy._run_code(runpy.py:87)←[0m
←[31mE/AndroidRuntime: at .runpy._run_module_code(runpy.py:97)←[0m
←[31mE/AndroidRuntime: at .runpy.run_module(runpy.py:225)←[0m
←[31mE/AndroidRuntime: at .chaquopy_java.call(chaquopy_java.pyx:352)←[0m
←[31mE/AndroidRuntime: at .chaquopy_java.Java_com_chaquo_python_PyObject_callAttrThrowsNative(chaquopy_java.pyx:324)←[0m
←[31mE/AndroidRuntime: at com.chaquo.python.PyObject.callAttrThrowsNative(Native Method)←[0m
←[31mE/AndroidRuntime: at com.chaquo.python.PyObject.callAttrThrows(PyObject.java:232)←[0m
←[31mE/AndroidRuntime: at com.chaquo.python.PyObject.callAttr(PyObject.java:221)←[0m
←[31mE/AndroidRuntime: at org.beeware.android.MainActivity.onCreate(MainActivity.java:85)←[0m
←[31mE/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8129)←[0m
←[31mE/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8109)←[0m
←[31mE/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1344)←[0m
←[31mE/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3750)←[0m
←[31mE/AndroidRuntime: ... 12 more←[0m
←[32mI/Process : Sending signal. PID: 1399 SIG: 9←[0m
Additional context
No response