首页 > 解决方案 > 无法应用类 MapSettings 中的方法 setIsolatedDiskCacheRootPath (HereMaps)

问题描述

大家好你们好

  1. 我正在尝试为 ReactNative 更新HereMaps - Premium-Pack 以前的 CodeBase 版本在(V3.16)上运行良好
  2. 我实际上使用的是新的HereMaps-Premium-Pack版本(V3.18
  3. 我有这个错误消息:

错误 无法安装应用程序。确保您已设置 Android 开发环境: https ://reactnative.dev/docs/environment-setup 。错误:命令失败:./gradlew app:installDebug -PreactNativeDevServerPort=8081 /Users/UserName/HereMapsProject/android/app/src/main/java/com/hermapsproject/HereMaps.java:117:错误:类 MapSettings 中的方法 setIsolatedDiskCacheRootPath 不能应用于给定类型;布尔成功 = com.here.android.mpa.common.MapSettings.setIsolatedDiskCacheRootPath(context.getApplicationContext().getExternalFilesDir(null)

  • File.separator + ".here-maps","globeIntent"); ^ 必需:找到的字符串:字符串,字符串原因:实际参数列表和形式参数列表的长度不同 注意:某些输入文件使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以获取详细信息。1 个错误

我该如何补救这个..?

private void init(Context context) {
       
        mContext = context;
        mView = inflater.inflate(R.layout.mapview, this);
        mapFragment = (AndroidXMapFragment) ((AppCompatActivity)((ContextWrapper) context).getBaseContext()).getSupportFragmentManager().findFragmentById(R.id.mapfragment);
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
        
        boolean success = com.here.android.mpa.common.MapSettings.setIsolatedDiskCacheRootPath(context.getApplicationContext().getExternalFilesDir(null) + File.separator + ".here-maps","globeIntent");
        
        if (!success) { Toast.makeText(context.getApplicationContext(), "Unable to set isolated disk cache path.", Toast.LENGTH_LONG);} 
           
                 else { mapFragment.init(new OnEngineInitListener() { @Overridepublic void onEngineInitializationCompleted(OnEngineInitListener.Error error) { 
            
                   if (error == OnEngineInitListener.Error.NONE) {

                        map = mapFragment.getMap();
                        map.setProjectionMode(Map.Projection.GLOBE);
                        map.setZoomLevel(initialZoomLevel);
                        map.setTilt(initialTilt);
                        map.setMapScheme(Map.Scheme.CARNAV_HYBRID_DAY);
                        map.setVisibleLayers(initialVisibleLayer, false);
                        mapFragment.getMapGesture().setDoubleTapEnabled(false);
                        mapFragment.getMapGesture().setTwoFingerPanningEnabled(false);
                        mapFragment.getMapGesture().setTwoFingerTapEnabled(false);
                        mapFragment.getMapGesture().addOnGestureListener(new MyGestureListener(), 0, false);
                        map.addTransformListener(new Map.OnTransformListener() {
                            @Override
                            public void onMapTransformStart() {

                            }

                            @Override
                            public void onMapTransformEnd(MapState mapState) {
                                mMarkManager.interpretCountry(mapState.getCenter());
                            }
                        });

关于setIsolatedDiskCacheRootPath的 HereMaps 文档:

https://developers.here.com/documentation/android-premium/3.17/content/api_reference_java/com/here/android/mpa/common/MapSettings.html#setIsolatedDiskCacheRootPath-java.lang.String-

VS 代码错误说明

标签: heremapsheremaps-android-sdk

解决方案


推荐阅读