OSM 奖励包 - OSRMRoadManager::getRoad:请求失败

OSM Bonus Pack - OSRMRoadManager::getRoad: request failed

这是我的问题,我正在尝试使用 osm bonus pack 在 2 waypoints 之间创建一条路由,但我遇到了直线错误和此调试器错误:"E/BONUSPACK: OSRMRoadManager::getRoad: request failed".

我关注了 these instructions 但没有成功。

这是我的代码:

public class DashboardFragment extends Fragment implements View.OnClickListener {

private DashboardViewModel dashboardViewModel;
private static Context context;
MapView map = null;
private MyLocationNewOverlay mLocationOverlay;
Button calcButton;
EditText departure;
EditText arrival;
String startPoint_str;
String endPoint_str;
Geocoder geocoder;
List<Address> addresses;
List<Address> addresses2;
public static Road[] mRoads;

public View onCreateView(@NonNull LayoutInflater inflater,
                         ViewGroup container, Bundle savedInstanceState) {
    dashboardViewModel =
            ViewModelProviders.of(this).get(DashboardViewModel.class);
    View root = inflater.inflate(R.layout.fragment_dashboard, container, false);
    final TextView textView = root.findViewById(R.id.text_dashboard);
    dashboardViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
        @Override
        public void onChanged(@Nullable String s) {
            textView.setText(s);
        }
    });
    createMap(root);
    return root;
}


public void createMap(View root) {

    Context ctx = getActivity().getApplicationContext();
    Configuration.getInstance().load(ctx, PreferenceManager.getDefaultSharedPreferences(ctx));

    calcButton = (Button) root.findViewById(R.id.CalcButton);
    departure = (EditText) root.findViewById(R.id.StartPointTxt);
    arrival = (EditText) root.findViewById(R.id.EndPointTxt);
    geocoder = new Geocoder(ctx);

    map = root.findViewById(R.id.map);
    map.setTileSource(TileSourceFactory.MAPNIK);
    map.setMultiTouchControls(true);
    IMapController mapController = map.getController();
    map.getZoomController().setVisibility(CustomZoomButtonsController.Visibility.SHOW_AND_FADEOUT);
    mapController.setZoom(15.0);
    GeoPoint startPoint = new GeoPoint(48.0833, -1.6833);
    mapController.setCenter(startPoint);

    this.mLocationOverlay = new MyLocationNewOverlay(new GpsMyLocationProvider(ctx), map);
    this.mLocationOverlay.enableMyLocation();
    map.getOverlays().add(this.mLocationOverlay);
    calcButton.setOnClickListener(this);
}

public void onClick(View v) {
    {
        startPoint_str = departure.getText().toString();
        endPoint_str = arrival.getText().toString();
        try {
            addresses = geocoder.getFromLocationName(startPoint_str, 1);
            addresses2 = geocoder.getFromLocationName(endPoint_str, 1);
        } catch (IOException e) {
            e.printStackTrace();
        }

        if(addresses.size() > 0 && addresses2.size() > 0) {
            GeoPoint StartPoint = new GeoPoint(addresses.get(0).getLatitude(), addresses.get(0).getLongitude());
            GeoPoint EndPoint = new GeoPoint(addresses2.get(0).getLatitude(), addresses2.get(0).getLongitude());

            ArrayList<GeoPoint> waypoints = new ArrayList<GeoPoint>();
            mRoads = null;
            waypoints.add(StartPoint);
            waypoints.add(EndPoint);
            RoadManager roadManager = new OSRMRoadManager(getActivity());
            Marker startMarker = new Marker(map);
            startMarker.setPosition(StartPoint);
            startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
            map.getOverlays().add(startMarker);
            Marker endMarker = new Marker(map);
            endMarker.setPosition(EndPoint);
            endMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
            map.getOverlays().add(endMarker);
            new UpdateRoadTask().execute(waypoints);
            map.invalidate();
        }
    }

}

private class UpdateRoadTask extends AsyncTask<Object, Void, Road[]> {

    protected Road[] doInBackground(Object... params) {
        @SuppressWarnings("unchecked")
        ArrayList<GeoPoint> waypoints = (ArrayList<GeoPoint>) params[0];
        RoadManager roadManager = new OSRMRoadManager(getActivity());
        return roadManager.getRoads(waypoints);
    }

    @Override
    protected void onPostExecute(Road[] roads) {
        mRoads = roads;
        if (roads == null)
            return;
        if (roads[0].mStatus == Road.STATUS_TECHNICAL_ISSUE)
            Toast.makeText(map.getContext(), "Technical issue when getting the route", Toast.LENGTH_SHORT).show();
        else if (roads[0].mStatus > Road.STATUS_TECHNICAL_ISSUE) //functional issues
            Toast.makeText(map.getContext(), "No possible route here", Toast.LENGTH_SHORT).show();
        Polyline[] mRoadOverlays = new Polyline[roads.length];
        List<Overlay> mapOverlays = map.getOverlays();
        for (int i = 0; i < roads.length; i++) {
            Polyline roadPolyline = RoadManager.buildRoadOverlay(roads[i]);
            mRoadOverlays[i] = roadPolyline;
            String routeDesc = roads[i].getLengthDurationText(getActivity(), -1);
            roadPolyline.setTitle(getString(R.string.app_name) + " - " + routeDesc);
            roadPolyline.setInfoWindow(new BasicInfoWindow(org.osmdroid.bonuspack.R.layout.bonuspack_bubble, map));
            roadPolyline.setRelatedObject(i);
            mapOverlays.add(1, roadPolyline);
        }
    }
}}

是的,很丑,对不起^^'

设备已连接到互联网并且应用程序具有所需的所有权限。

这是 request url,我在 AsyncTask 中执行此请求。

问题是 OSRM 道路管理器正在发送 http 请求。

Android Pie 只接受 https 请求。

我通过 .

在我的应用程序中允许 http 请求来解决这个问题