【问题标题】:HERE Maps Android Integration, MISSING_LIBRARIES ErrorHERE Maps Android 集成,MISSING_LIBRARIES 错误
【发布时间】:2016-05-15 01:57:22
【问题描述】:

我按照步骤 https://developer.here.com/mobile-sdks/documentation/android/topics/app-simple-android-studio.html

但我收到错误消息:无法初始化地图片段 MISSING_LIBRARIES

地图初始化代码:

mapFragment.init(new OnEngineInitListener() {
            @Override
            public void onEngineInitializationCompleted(OnEngineInitListener.Error error) {
                if (error == OnEngineInitListener.Error.NONE) {
                    // retrieve a reference of the map from the map fragment
                    map = mapFragment.getMap();
                    // Set the map center to the Vancouver region (no animation)
                    map.setCenter(new GeoCoordinate(49.196261, -123.004773, 0.0),
                            Map.Animation.NONE);
                    // Set the zoom level to the average between min and max
                    map.setZoomLevel(
                            (map.getMaxZoomLevel() + map.getMinZoomLevel()) / 2);
                } else {
                    System.out.println("ERROR: Cannot initialize Map Fragment " + error.toString());
                    Toast.makeText(MainActivity.this, " Error: " + error.toString(), Toast.LENGTH_LONG).show();
                }
            }
        });

毕业代码

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.chethan.mobileapp.startmap"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:design:22.2.1'
    compile files('libs/HERE-sdk.jar')
    compile files('libs/jts-1.14.jar')
}

清单代码:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ethan.mobileapp.startmap">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:hardwareAccelerated="true"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data android:name="com.here.android.maps.appid" android:value="Ksn3W" />
        <meta-data android:name="com.here.android.maps.apptoken" android:value="m90-Q" />
        <!--<meta-data android:name="com.here.android.maps.license.key" android:value="{J8XXfNbyt7M=}" />
-->
    </application>

</manifest>

任何建议都非常感谢

【问题讨论】:

    标签: android here-api


    【解决方案1】:

    我相信您查看的文档有误。在此页面上:https://developer.here.com/documentation 列出了 HERE Android 移动 SDK 的两个版本,即适用于 Android Starter 的 SDK 和适用于 Android Premium 的 SDK。当我认为您需要 Premium 时,您正在查看 Starter 的文档。

    Premium SDK 有一个本地库组件,需要包含在构建中。试试这个页面:https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics/app-simple-android-studio.html(“将 HERE SDK 库添加到您的项目”部分)

    具体来说,我相信这些是您错过的部分:

    • 从安装 HERE SDK 的目录中,将 HERE-sdk/libs/armeabi-v7a 文件夹的内容复制到项目的 app/src/main/jniLibs/armeabi 文件夹。您需要创建 jniLibs 和 armeabi 子文件夹。

    • 在您的 AndroidManifest.xml 文件的同一部分中,添加以下行:

      <service android:name="com.here.android.mpa.service.MapService" android:label="HereMapService" android:process="global.Here.Map.Service.v2" android:exported="true" > <intent-filter> <action android:name="com.here.android.mpa.service.MapService" > </action> </intent-filter> </service>

    更新

    从 HERE SDK 版本 3.3 开始,SDK 以 Android 存档 (AAR) 文件的形式提供。因此,您不再需要像上面第一个项目符号中提到的那样手动复制本机库。您可以简单地将 AAR 文件包含在您的 build.gradle 文件。例如:

    // Assuming you have placed the HERE-sdk.aar in a folder 'libs'
    repositories {
        flatDir {
            dirs 'libs'
        }
    }
    
    dependencies {
       ...
       compile(name: 'HERE-sdk', ext: 'aar')
       ...
    }
    

    【讨论】:

    • 上述步骤已完成,但我得到了 MISSING_PERMISSION
    • System.out:错误:无法初始化地图片段未知
    • System.out:错误:无法初始化地图片段 MISSING_PERMISSION
    • 此处地图中未传达特定错误消息
    • 您需要有一个正确的AppId, AppCode and LicenseKey 才能使用SDK。看到这个页面:developer.here.com/mobile-sdks/documentation/…。从您的 AndroidManifest 中,我看到许可证密钥字段已被注释掉。
    【解决方案2】:

    确保您的设备满足here 列出的系统要求。具体来说,请确保您的设备是 ARM 而不是 x86。

    我在 HP Pro Slate 10 EE G1 上运行 HERE 地图时遇到了“MISSING_LIBRARIES”错误。此平板电脑是 x86,当前 HERE SDK 不支持。 ARM 本机代码使用名为 Houdini 的模拟器在 Intel x86 上运行。对此的解释可以在here找到。

    很遗憾,我知道这并不能解决您的问题。但它可能会帮助您了解应用程序不会初始化地图的原因。

    【讨论】:

      【解决方案3】:

      如果您在项目中有另一个带有 JNI 的库,也会发生这种情况。 在这种情况下,在 build.gradle 的 buildType 下包含以下代码:

              splits {
                  abi {
                      enable true
                      reset()
                      include 'armeabi-v7a'
                      universalApk false
                  }
              }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-01-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-04-13
        • 1970-01-01
        相关资源
        最近更新 更多