Я провел несколько модульных тестов, представленных в ссылке: https://github.com/googlemaps/google-maps-services-java. Я не могу найти класс DirectionsResult в пакете com.google.maps.model. Я прикрепляю моментальный снимок зависимостей gradle и фрагмент кода, который я использовал в одном из тестовых примеров. Пожалуйста, дайте мне знать, где я ошибаюсь? Благодаря !Невозможно найти DirectionsResult класс в com.google.maps.model package
Тестовый пример фрагмент кода было что-то вроде этого:
package com.google.maps;
import com.google.maps.DirectionsApi.RouteRestriction;
import com.google.maps.errors.NotFoundException;
import com.google.maps.model.AddressType;
import com.google.maps.model.DirectionsResult;
import com.google.maps.model.GeocodedWaypointStatus;
import com.google.maps.model.TrafficModel;
import com.google.maps.model.TransitMode;
import com.google.maps.model.TransitRoutingPreference;
import com.google.maps.model.TravelMode;
import com.google.maps.model.Unit;
import org.joda.time.DateTime;
import org.joda.time.Duration;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.util.concurrent.TimeUnit;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
@Category(LargeTests.class)
public class DirectionsApiTest extends AuthenticatedTest {
private GeoApiContext context;
public DirectionsApiTest(GeoApiContext context) {
this.context = context
.setQueryRateLimit(3)
.setConnectTimeout(1, TimeUnit.SECONDS)
.setReadTimeout(1, TimeUnit.SECONDS)
.setWriteTimeout(1, TimeUnit.SECONDS);
}
@Test
public void testGetDirections() throws Exception {
DirectionsResult result = DirectionsApi.getDirections(context, "Sydney, AU",
"Melbourne, AU").await();
assertNotNull(result.routes);
assertNotNull(result.routes[0]);
assertThat(result.routes[0].overviewPolyline.decodePath().size(), not(0));
assertEquals("Sydney NSW, Australia", result.routes[0].legs[0].startAddress);
assertEquals("Melbourne VIC, Australia", result.routes[0].legs[0].endAddress);
}
}
Просьба поделиться обнаруженной ошибкой, которая появляется в консоли. – Teyam
Ошибка была класс не найден в пакете. Я понял, что после изменения зависимости от компиляции 'com.google.maps: google-maps-services: 0.1.2' для компиляции 'com.google.maps: google-maps-services: 0.1.12'. Я не мог найти ни одного документа, в котором упоминается, что класс DirectionsResult устарел из пакета com.google.maps.model.DirectionsResult; – user2582651