eastywest
@eastywest
Backend developer

Как подключить Yandex MapKit к Android Studio?

Бьюсь над проблемой подключения Yandex MapKit к Android Studio. Перепробовал разные способы. Всегда выдает одну и ту же ошибку. В чем может быть проблема?

07-24 13:42:11.919  24970-24970/ru.orionnet.simplemaps D/dalvikvm﹕ Trying to load lib /data/data/ru.orionnet.simplemaps/lib/libcache_local.so 0x2bde87d8
07-24 13:42:11.999  24970-24970/ru.orionnet.simplemaps D/dalvikvm﹕ Added shared lib /data/data/ru.orionnet.simplemaps/lib/libcache_local.so 0x2bde87d8
07-24 13:42:11.999  24970-24970/ru.orionnet.simplemaps D/dalvikvm﹕ No JNI_OnLoad found in /data/data/ru.orionnet.simplemaps/lib/libcache_local.so 0x2bde87d8, skipping init
07-24 13:42:12.059  24970-24970/ru.orionnet.simplemaps D/ru.yandex.OpenKODE﹕ android.cpp.mountSharedFileSystem()
07-24 13:42:12.059  24970-24970/ru.orionnet.simplemaps D/ru.yandex.OpenKODE﹕ android.cpp.mountSharedFileSystem()[shared fs mounted to: /mnt/sdcard]
07-24 13:42:12.249  24970-24970/ru.orionnet.simplemaps W/dalvikvm﹕ VFY: unable to resolve static field 9393 (ymk_map_layers) in Lru/yandex/yandexmapkit/R$xml;
07-24 13:42:12.249  24970-24970/ru.orionnet.simplemaps D/dalvikvm﹕ VFY: replacing opcode 0x60 at 0x005e
07-24 13:42:12.279  24970-24972/ru.orionnet.simplemaps D/dalvikvm﹕ GC_CONCURRENT freed 223K, 4% free 9054K/9415K, paused 10ms+2ms
07-24 13:42:12.289  24970-24970/ru.orionnet.simplemaps W/dalvikvm﹕ VFY: unable to resolve static field 9387 (ymk_screen_buttons_layout) in Lru/yandex/yandexmapkit/R$layout;
07-24 13:42:12.289  24970-24970/ru.orionnet.simplemaps D/dalvikvm﹕ VFY: replacing opcode 0x60 at 0x000b
07-24 13:42:12.309  24970-24970/ru.orionnet.simplemaps W/dalvikvm﹕ VFY: unable to resolve static field 9390 (ymk_lang) in Lru/yandex/yandexmapkit/R$string;
07-24 13:42:12.309  24970-24970/ru.orionnet.simplemaps D/dalvikvm﹕ VFY: replacing opcode 0x60 at 0x0005
07-24 13:42:12.319  24970-24970/ru.orionnet.simplemaps D/AndroidRuntime﹕ Shutting down VM
07-24 13:42:12.319  24970-24970/ru.orionnet.simplemaps W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x2b542210)
07-24 13:42:12.339  24970-24970/ru.orionnet.simplemaps E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{ru.orionnet.simplemaps/ru.orionnet.simplemaps.YandexMapActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class ru.yandex.yandexmapkit.MapView
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
            at android.app.ActivityThread.access$600(ActivityThread.java:127)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4441)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class ru.yandex.yandexmapkit.MapView
            at android.view.LayoutInflater.createView(LayoutInflater.java:606)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
            at android.app.Activity.setContentView(Activity.java:1835)
            at ru.orionnet.simplemaps.YandexMapActivity.onCreate(YandexMapActivity.java:14)
            at android.app.Activity.performCreate(Activity.java:4465)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
            at android.app.ActivityThread.access$600(ActivityThread.java:127)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4441)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.reflect.InvocationTargetException
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
            at android.view.LayoutInflater.createView(LayoutInflater.java:586)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
            at android.app.Activity.setContentView(Activity.java:1835)
            at ru.orionnet.simplemaps.YandexMapActivity.onCreate(YandexMapActivity.java:14)
            at android.app.Activity.performCreate(Activity.java:4465)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
            at android.app.ActivityThread.access$600(ActivityThread.java:127)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4441)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.NoClassDefFoundError: ru.yandex.yandexmapkit.R$string
            at ck.a(Unknown Source)
            at ru.yandex.yandexmapkit.MapController.<init>(Unknown Source)
            at ru.yandex.yandexmapkit.MapSurfaceView.init(Unknown Source)
            at ru.yandex.yandexmapkit.MapSurfaceView.<init>(Unknown Source)
            at ru.yandex.yandexmapkit.MapView.<init>(Unknown Source)
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
            at android.view.LayoutInflater.createView(LayoutInflater.java:586)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
            at android.app.Activity.setContentView(Activity.java:1835)
            at ru.orionnet.simplemaps.YandexMapActivity.onCreate(YandexMapActivity.java:14)
            at android.app.Activity.performCreate(Activity.java:4465)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
            at android.app.ActivityThread.access$600(ActivityThread.java:127)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4441)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
            at dalvik.system.NativeStart.main(Native Method)


Кто может описать работающий способ подключения библиотеки к Android Studio?
  • Вопрос задан
  • 5484 просмотра
Решения вопроса 1
eastywest
@eastywest Автор вопроса
Backend developer
Нашел решение

Удалил из build.gradle модуля yandexmapkitlibrary такой кусок кода

sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}

// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')

// Move the build types to build-types/
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src//... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}


и все благополучно заработало
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
@pirogtm
Столкнулся с падением карт при использовании в фрагменте. Версия 3.5.0. Помогло понижение до версии 3.2.0. Может кому-то будет полезно.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы