我想构建一个需要地图功能的应用程序,我遇到了 Skobbler 和他们的 SKMaps SDK。我已按照网站上的说明在 Eclipse 中将 SDK 集成到我的 Android 项目中:
添加到您的项目文件夹中
/libs/armeabi/libsngnative.so /libs/armeabi-v7a/libsnative.so /libs/x86/libsnative.so 在您的 libs 文件夹中添加 SKMaps.jar 并构建路径 将项目中的 SKMaps.zip 文件复制到 assets 文件夹中 添加在你的 AndroidManifest.xml 这些设置:
现在,当我使用 SDK 中的类编写代码时,它们会在我的项目中被识别,但是当我启动应用程序时它会崩溃,说找不到类。
05-02 02:57:47.699: E/dalvikvm(26118): Could not find class 'com.skobbler.sdkdemo.activity.MapActivity', referenced from method com.example.skobblermap.SplashActivity.onCreate
05-02 02:57:47.704: W/dalvikvm(26118): VFY: unable to resolve const-class 1789 (Lcom/skobbler/sdkdemo/activity/MapActivity;) in Lcom/example/skobblermap/SplashActivity;
05-02 02:57:47.704: D/dalvikvm(26118): VFY: replacing opcode 0x1c at 0x008e
05-02 02:57:47.909: D/SKMaps(26118): SKMapInitSettings---- Map style [/storage/emulated/0/Android/data/com.example.skobblermap/files/SKMaps/daystyle/ , daystyle.json ,-1]
05-02 02:57:47.909: D/dalvikvm(26118): Trying to load lib /data/app-lib/com.example.skobblermap-1/libngnative.so 0x42aeb728
05-02 02:57:47.924: W/System.err(26118): java.io.FileNotFoundException: /storage/emulated/0/SKMaps/mapcreatorFile.json: open failed: ENOENT (No such file or directory)
05-02 02:57:47.934: W/System.err(26118): at libcore.io.IoBridge.open(IoBridge.java:409)
05-02 02:57:47.934: W/System.err(26118): at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
05-02 02:57:47.934: W/System.err(26118): at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
05-02 02:57:47.934: W/System.err(26118): at com.example.skobblermap.sdkdemo.util.DemoUtils.copyAsset(DemoUtils.java:82)
05-02 02:57:47.934: W/System.err(26118): at com.example.skobblermap.SplashActivity$3.run(SplashActivity.java:125)
05-02 02:57:47.934: W/System.err(26118): at java.lang.Thread.run(Thread.java:841)
05-02 02:57:47.934: W/System.err(26118): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
05-02 02:57:47.944: W/System.err(26118): at libcore.io.Posix.open(Native Method)
05-02 02:57:47.944: W/System.err(26118): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
05-02 02:57:47.944: W/System.err(26118): at libcore.io.IoBridge.open(IoBridge.java:393)
05-02 02:57:47.944: W/System.err(26118): ... 5 more
05-02 02:57:48.139: D/dalvikvm(26118): Added shared lib /data/app-lib/com.example.skobblermap-1/libngnative.so 0x42aeb728
05-02 02:57:48.154: D/SKMaps(26118): SKmaps---- INITIALIZE SK MAPS WITH SETTINGS
05-02 02:57:48.154: D/SKMaps(26118): SKmaps----versionFileName = version2_public_sdk_android_2_0.txt
05-02 02:57:48.159: D/SKMaps(26118): SKUtils----Return calculated device type 1
05-02 02:57:48.159: D/SKMaps(26118): SKmaps----ADVISOR com.skobbler.ngx.navigation.SKAdvisorSettings@42b1b478
05-02 02:57:48.159: D/SkobblerNG(26118): AdvisorConfigPath : /storage/emulated/0/Android/data/com.example.skobblermap/files/SKMaps/Maps/Advisor/en/advisor_configfiles/
05-02 02:57:48.159: D/SkobblerNG(26118): AdvisorBundlePath : /storage/emulated/0/Android/data/com.example.skobblermap/files/SKMaps/Maps/Advisor/
05-02 02:57:48.159: D/SkobblerNG(26118): VisualAdvicesDirPath : /storage/emulated/0/Android/data/com.example.skobblermap/files/SKMaps/Maps/Advisor/Visual/
05-02 02:57:48.159: D/SkobblerNG(26118): LanguageCode : en
05-02 02:57:48.159: D/SKMaps(26118): SKmaps----Json file /storage/emulated/0/Android/data/com.example.skobblermap/files/SKMaps/daystyle/daystyle.json
05-02 02:57:48.159: D/SKMaps(26118): SKUtils----Return calculated device type 1
05-02 02:57:48.159: D/SkobblerNG(26118): before NG_Initialize()
05-02 02:57:48.809: D/SkobblerNG(26118): passed NG_Initialize()
05-02 02:57:48.809: D/SkobblerNG(26118): Set navigation callbacks!
05-02 02:57:48.809: D/SkobblerNG(26118): init() finished
05-02 02:57:48.819: D/SKMaps(26118): SKUtils----found proxyUser: null, proxyPassword: null
05-02 02:57:48.949: D/SKMaps(26118): SKmaps----UID = f53fceaf53dfbee606611526ee632a;dde7d03f82481573f918d3c421885e2;693fc60c7d5b8f8e3e18ef61e63e6;852b95520ac3a8be18a5cb76a66ad
05-02 02:57:48.949: D/SKMaps(26118): SKmaps----key = osName , value = android
05-02 02:57:48.949: D/SKMaps(26118): SKmaps----key = osVer , value = 4.3
05-02 02:57:48.949: D/SKMaps(26118): SKmaps----key = appName , value =
05-02 02:57:48.949: D/SKMaps(26118): SKmaps----key = appVer , value =
05-02 02:57:48.949: D/SKMaps(26118): SKmaps----key = uid , value = f53fceaf53dfbee606611526ee632a;dde7d03f82481573f918d3c421885e2;693fc60c7d5b8f8e3e18ef61e63e6;852b95520ac3a8be18a5cb76a66ad
05-02 02:57:48.964: D/dalvikvm(26118): Trying to load lib /data/app-lib/com.example.skobblermap-1/libngnative.so 0x42aeb728
05-02 02:57:48.964: D/dalvikvm(26118): Shared lib '/data/app-lib/com.example.skobblermap-1/libngnative.so' already loaded in same CL 0x42aeb728
05-02 02:57:48.964: D/SKMaps(26118): SKmaps----INITIALIZE FCD accountKey= locale= en macAddress=90:18:7C:4F:8B:8D osName=android osVersion=4.3 deviceMaker =samsung deviceModel=GT-I9300 orientation= 1 appid=f53fceaf53dfbee606611526ee632a;dde7d03f82481573f918d3c421885e2;693fc60c7d5b8f8e3e18ef61e63e6;852b95520ac3a8be18a5cb76a66ad appName= appVersion= serverUrl=http://tor.skobbler.net/tor
05-02 02:57:48.969: D/SKMaps(26118): SKmaps----ENABLE FCD true
05-02 02:57:49.329: D/AndroidRuntime(26118): Shutting down VM
05-02 02:57:49.329: W/dalvikvm(26118): threadid=1: thread exiting with uncaught exception (group=0x42096700)
05-02 02:57:49.364: E/AndroidRuntime(26118): FATAL EXCEPTION: main
05-02 02:57:49.364: E/AndroidRuntime(26118): java.lang.NoClassDefFoundError: com.skobbler.sdkdemo.activity.MapActivity
05-02 02:57:49.364: E/AndroidRuntime(26118): at com.example.skobblermap.SplashActivity.onCreate(SplashActivity.java:66)
05-02 02:57:49.364: E/AndroidRuntime(26118): at android.app.Activity.performCreate(Activity.java:5372)
05-02 02:57:49.364: E/AndroidRuntime(26118): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
05-02 02:57:49.364: E/AndroidRuntime(26118): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
05-02 02:57:49.364: E/AndroidRuntime(26118): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
05-02 02:57:49.364: E/AndroidRuntime(26118): at android.app.ActivityThread.access$700(ActivityThread.java:159)
05-02 02:57:49.364: E/AndroidRuntime(26118): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
05-02 02:57:49.364: E/AndroidRuntime(26118): at android.os.Handler.dispatchMessage(Handler.java:99)
05-02 02:57:49.364: E/AndroidRuntime(26118): at android.os.Looper.loop(Looper.java:176)
05-02 02:57:49.364: E/AndroidRuntime(26118): at android.app.ActivityThread.main(ActivityThread.java:5419)
05-02 02:57:49.364: E/AndroidRuntime(26118): at java.lang.reflect.Method.invokeNative(Native Method)
05-02 02:57:49.364: E/AndroidRuntime(26118): at java.lang.reflect.Method.invoke(Method.java:525)
05-02 02:57:49.364: E/AndroidRuntime(26118): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
05-02 02:57:49.364: E/AndroidRuntime(26118): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
05-02 02:57:49.364: E/AndroidRuntime(26118): at dalvik.system.NativeStart.main(Native Method)
05-02 02:57:51.964: D/SKMaps(26118): SKVersionManager---- newversioncallback updatemapversionstatus=-2
05-02 02:57:51.964: D/SKMaps(26118): SKVersionManager----Version file update status = -2 timeout
05-02 02:57:51.964: D/SKMaps(26118): SKVersionManager----Request done at startup
05-02 02:57:51.969: D/SKMaps(26118): SKVersionManager----Current version is 20140320
05-02 02:57:51.969: D/SKMaps(26118): SKVersionManager---- Map has a version = 20140320 mapVersionSet =true
05-02 02:57:59.729: I/Process(26118): Sending signal. PID: 26118 SIG: 9
我做了什么:
我最初创建了一个新项目,按照说明集成 sdk,复制 SplashActivity 类并将其设置为启动器。
有谁知道我是否需要复制项目中的其他一些类才能使其正常工作?
我需要的是一张至少能显示我所在位置的地图。然后我将能够尝试实现我需要的其余东西,但我无法开始。