我目前正在使用Google Maps API,并且尝试将带有标记的GEOJSON文件作为图层连接到地图。
我从文档中摘录的行现在正在尝试使用:
GeoJsonLayer layer = new GeoJsonLayer(getMap(), R.raw.geoJsonFile,
getApplicationContext());
Run Code Online (Sandbox Code Playgroud)
错误是 Cannot resolve symbol 'GeoJsonLayer'
我已经将编译添加org.json:json:20090211到了我的依赖项中,但这并没有解决问题。
我正在使用Android Studio为Android OS编码。
有什么帮助吗?谢谢
编辑:
班级代码:
package com.example.macbookair........;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.maps.android.geojson.GeoJsonLayer;
import org.json.JSONException;
import java.io.IOException;
public class Maps extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
private GeoJsonLayer layer1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified …Run Code Online (Sandbox Code Playgroud)