提问人:beli3ver 提问时间:8/8/2017 最后编辑:Phantômaxxbeli3ver 更新时间:12/13/2021 访问量:761
Mapsforge InternalRenderTheme缺失错误
Mapsforge InternalRenderTheme Missing Error
问:
我尝试用 mapsforge 开始我的第一个项目。所以我这样做了,更改 app/build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'org.mapsforge:mapsforge-map-android:0.8.0'
compile 'com.caverock:androidsvg:1.2.2-beta-1'
compile('org.mapsforge:mapsforge-map-android-extras:0.8.0') {
transitive = false
}
}
然后,我从这里获取代码:代码示例应用。 这是我的MainActivity
package kn.com.ff_map;
import android.os.Bundle;
import android.app.Activity;
import android.os.Environment;
import org.mapsforge.core.model.LatLong;
import org.mapsforge.map.android.graphics.AndroidGraphicFactory;
import org.mapsforge.map.android.util.AndroidUtil;
import org.mapsforge.map.android.view.MapView;
import org.mapsforge.map.datastore.MapDataStore;
import org.mapsforge.map.layer.cache.TileCache;
import org.mapsforge.map.layer.renderer.TileRendererLayer;
import org.mapsforge.map.reader.MapFile;
import org.mapsforge.map.rendertheme.InternalRenderTheme;
import java.io.File;
public class MainActivity extends Activity {
// name of the map file in the external storage
private static final String MAP_FILE = "berlin.map";
private MapView mapView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidGraphicFactory.createInstance(this.getApplication());
this.mapView = new MapView(this);
setContentView(this.mapView);
this.mapView.setClickable(true);
this.mapView.getMapScaleBar().setVisible(true);
this.mapView.setBuiltInZoomControls(true);
this.mapView.setZoomLevelMin((byte) 10);
this.mapView.setZoomLevelMax((byte) 20);
// create a tile cache of suitable size
TileCache tileCache = AndroidUtil.createTileCache(this, "mapcache",
mapView.getModel().displayModel.getTileSize(), 1f,
this.mapView.getModel().frameBufferModel.getOverdrawFactor());
// tile renderer layer using internal render theme
MapDataStore mapDataStore = new MapFile(new File(Environment.getExternalStorageDirectory(), MAP_FILE));
TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, mapDataStore,
this.mapView.getModel().mapViewPosition, AndroidGraphicFactory.INSTANCE);
tileRendererLayer.setXmlRenderTheme(InternalRenderTheme.DEFAULT);
// only once a layer is associated with a mapView the rendering starts
this.mapView.getLayerManager().getLayers().add(tileRendererLayer);
this.mapView.setCenter(new LatLong(52.517037, 13.38886));
this.mapView.setZoomLevel((byte) 12);
}
@Override
protected void onDestroy() {
this.mapView.destroyAll();
AndroidGraphicFactory.clearResourceMemoryCache();
super.onDestroy();
}
}
我总是得到错误,
错误:(16, 37) 错误:找不到符号类 InternalRenderTheme
错误:(50, 45) 错误:找不到符号变量 InternalRenderTheme
所以这是我第一次尝试在我的项目中集成一个库。我只这样做,我没有从存储库下载任何东西或复制任何东西。我必须下载 mapforge 还是这个错误意味着什么?
答:
3赞
Sevron
8/18/2017
#1
我的决定是添加到应用程序的build.gragle中
compile 'org.mapsforge:mapsforge-themes:0.8.0'
0赞
Alexey Zhukov
12/13/2021
#2
您需要删除以下行:test
以前:
<!-- https://mvnrepository.com/artifact/org.mapsforge/mapsforge-themes -->
<dependency>
<groupId>org.mapsforge</groupId>
<artifactId>mapsforge-themes</artifactId>
<version>${map.version}</version>
<scope>test</scope>
后:
<!-- https://mvnrepository.com/artifact/org.mapsforge/mapsforge-themes -->
<dependency>
<groupId>org.mapsforge</groupId>
<artifactId>mapsforge-themes</artifactId>
<version>${map.version}</version>
上一个:布尔玛卡内容变色
下一个:GTK 对话框边距不起作用
评论