Osmbonuspack 教程,Road manager 抛出错误

Osmbonuspack tutorial, Road manager throwing errors

我最近开始考虑使用 osmbonuspack,我开始使用教程 0 并开始使用,教程 1 你好路由世界我尝试使用教程代码和 osmbonuspacktuto 下 github 上提供的代码.但我不断收到同样的错误。错误是;

"java.lang.NoClassDefFoundError: Failed resolution of:Lokhttp3/Request$Builder;"

在行;

路路=roadManager.getRoad(wayPoints);

在搜索错误时,我看到了类似的错误,但@aar 的错误不同,我看到人们说这是因为等级依赖性?

这里有任何帮助都会很棒,这是我目前的代码;

Java Class;

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);

    Context ctx = getApplicationContext();
    //important! set your user agent to prevent getting banned from the osm servers
    Configuration.getInstance().load(ctx, PreferenceManager.getDefaultSharedPreferences(ctx));
    setContentView(R.layout.activity_new_map);

    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        // TODO: Consider calling
        //    ActivityCompat#requestPermissions
        // here to request the missing permissions, and then overriding
        //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
        //                                          int[] grantResults)
        // to handle the case where the user grants the permission. See the documentation
        // for ActivityCompat#requestPermissions for more details.
        return;
    }

    map = (MapView) findViewById(R.id.map11);

    map.setTileSource(TileSourceFactory.MAPNIK);

    map.setBuiltInZoomControls(true);
    map.setMultiTouchControls(true);

    GeoPoint startPoint = new GeoPoint(48.13,-1.63);

    IMapController mapController = map.getController();
    mapController.setZoom(9);
    mapController.setCenter(startPoint);

    Marker starterMarker = new Marker(map);

    starterMarker.setPosition(startPoint);

    starterMarker.setAnchor(Marker.ANCHOR_CENTER,Marker.ANCHOR_BOTTOM);

    map.getOverlays().add(starterMarker);

    map.invalidate();

    starterMarker.setIcon(getResources().getDrawable(R.drawable.bonuspack_bubble));
    starterMarker.setTitle("Start Point");

    RoadManager roadManager = new OSRMRoadManager(this);

    ArrayList<GeoPoint> wayPoints = new ArrayList<GeoPoint>();

    wayPoints.add(startPoint);
    GeoPoint endPoint = new GeoPoint(48.4,-1.9);
    wayPoints.add(endPoint);

    Road road = roadManager.getRoad(wayPoints);

    if (road.mStatus !=  Road.STATUS_OK){
        Toast.makeText(this, "Error when loading road", Toast.LENGTH_LONG).show();
    }

    Polyline roadOverlay = RoadManager.buildRoadOverlay(road);
    map.getOverlays().add(roadOverlay);




}

Gradle;

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'org.osmdroid:osmdroid-android:5.6.5@aar'
    implementation 'org.slf4j:slf4j-api:1.7.7@jar'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation project(':osmbonuspack_6.4')
}

我自己弄明白了,我在 gradle..

中遗漏了一些依赖项