Creating custom plugins: "No Activity found to handle Intent" Android error

Hi there,

I want to use a regular Android SDK and hook it up to my Capacitor app. I saw the Mapbox example and tried building a plugin (also tried adding native code without a plugin) but I always get:

2020-11-12 19:10:34.093 8267-8355/ E/AndroidRuntime: FATAL EXCEPTION: CapacitorPlugins
Process:, PID: 8267
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { (has extras) }

I followed this tutorial and took inspiration from the Mapbox example source code.

The Activity is there and created, I tried an empty activity as well as my real one, but it throws this error as soon as I use “startActivity” or “startActivityForResult”.

Example Code:

public class HereRoutingPlugin extends Plugin {

    public void createHereRoute(PluginCall call) {
        Double latitude = call.getDouble("lat");
        Double longitude = call.getDouble("lng");

        Intent intent = new Intent("");
        intent.putExtra("lat", latitude);
        intent.putExtra("lng", longitude);

        //startActivityForResult(call, intent, 1);

What am I missing?

Thanks!! :slight_smile: