Closed mjoy99 closed 1 month ago
This suggests you're missing the package dependency that provides osmdroid; is org.osmdroid:osmdroid-android:6.1.0
specified in the dependencies in build_gradle_dependencies
?
Along with the text of the error message above, this is documented in the MapView docs.
I completely missed that part in the documentation. I updated the project.toml and was able to get it to work. Although, I couldn't get it to add the dependency through any of the below. Not sure how you get gradle to see it has updated dependency requirements.
I tried:
briefcase update android -r
briefcase build android -u
briefcase create android
and a few others, but until I deleted the android build and did the create again, I couldn't get the depency to add in.
Describe the bug
when adding a toga.mapview and running on connected device I get the error osmdroid is missing. The app runs fine on devleopment platform
Steps to reproduce
briefcase create android
briefcase build android
briefcase run android
source code for app.py:
E/AndroidRuntime: FATAL EXCEPTION: main E/AndroidRuntime: Process: com.example.helloworld, PID: 16384 E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.helloworld/org.beeware.android.MainActivity}: com.chaquo.python.PyException: RuntimeError: Unable to import MapView. Ensure that the OSMDroid Android system package (org.osmdroid:osmdroid-android:6.1.0) is listed in your app's dependencies. E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4164) E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4322) E/AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) E/AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139) E/AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96) E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685) E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:230) E/AndroidRuntime: at android.os.Looper.loop(Looper.java:319) E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8893) E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608) E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103) E/AndroidRuntime: Caused by: com.chaquo.python.PyException: RuntimeError: Unable to import MapView. Ensure that the OSMDroid Android system package (org.osmdroid:osmdroid-android:6.1.0) is listed in your app's dependencies. E/AndroidRuntime: at.toga_android.widgets.mapview.create(mapview.py:42)
E/AndroidRuntime: at .toga_android.widgets.base.init(base.py:55)
E/AndroidRuntime: at .toga.widgets.mapview.init(mapview.py:158)
E/AndroidRuntime: at .helloworld.app.startup(app.py:31)
E/AndroidRuntime: at .toga.app._startup(app.py:636)
E/AndroidRuntime: at .toga_android.app.create(app.py:199)
E/AndroidRuntime: at .toga_android.app.main_loop(app.py:232)
E/AndroidRuntime: at .toga.app.main_loop(app.py:614)
E/AndroidRuntime: at .main.(main.py:4)
E/AndroidRuntime: at .runpy._run_code(runpy.py:86)
E/AndroidRuntime: at .runpy._run_module_code(runpy.py:96)
E/AndroidRuntime: at .runpy.run_module(runpy.py:224)
E/AndroidRuntime: at .chaquopy_java.call(chaquopy_java.pyx:354)
E/AndroidRuntime: at .chaquopy_java.Java_com_chaquo_python_PyObject_callAttrThrowsNative(chaquopy_java.pyx:326)
E/AndroidRuntime: at com.chaquo.python.PyObject.callAttrThrowsNative(Native Method)
E/AndroidRuntime: at com.chaquo.python.PyObject.callAttrThrows(PyObject.java:232)
E/AndroidRuntime: at com.chaquo.python.PyObject.callAttr(PyObject.java:221)
E/AndroidRuntime: at org.beeware.android.MainActivity.onCreate(MainActivity.java:85)
E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8944)
E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8913)
E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456)
E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4146)
E/AndroidRuntime: ... 12 more