HERE Maps Android集成,MISSING_LIBRARIES错误 [英] HERE Maps Android Integration, MISSING_LIBRARIES Error

查看:51
本文介绍了HERE Maps Android集成,MISSING_LIBRARIES错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

but I am getting error as : Cannot initialize Map Fragment 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>

任何值得赞赏的建议

推荐答案

我认为您正在查看错误的文档.在此页面上: https://developer.here.com/documentation 这里有两个版本列出了Android Mobile SDK,适用于Android Starter的SDK和适用于Android Premium的SDK.当我认为您需要高级版时,您正在查看Starter的文档.

I believe you're looking at the wrong documentation. On this page: https://developer.here.com/documentation there are two versions of the HERE Android Mobile SDK listed, SDK for Android Starter and SDK for Android Premium. You are looking at the documentation for Starter when I think you want Premium.

Premium SDK具有一个本机库组件,该组件需要包含在构建中.尝试以下页面: https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics/app-simple-android-studio.html (在此处将SDK库添加到您的项目"部分)

The Premium SDK has a native library component which needs to be included in the build. Try this page: https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics/app-simple-android-studio.html ("Add HERE SDK Libraries to Your Project" section)

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

Specifically, I believe these are the sections you missed:

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

  • From the directory where you installed the HERE SDK, copy the contents of the HERE-sdk/libs/armeabi-v7a folder to your project's app/src/main/jniLibs/armeabi folder. You need to create the jniLibs and armeabi subfolders.

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

Within the same section in your AndroidManifest.xml file, add the following lines:

<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>

<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文件.例如:

As of HERE SDK version 3.3 the SDK is delivered as an Android Archive (AAR) file. Therefore, you no longer need to manually copy the native libraries as mentioned in the first bullet above. You can simply include the AAR file in your build.gradle file. e.g.:

// Assuming you have placed the HERE-sdk.aar in a folder 'libs'
repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
   ...
   compile(name: 'HERE-sdk', ext: 'aar')
   ...
}

这篇关于HERE Maps Android集成,MISSING_LIBRARIES错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆