Why "HereMap" shows blank screen In Android?
Asked Answered
L

3

5

I Follow this tutorial link for Nokia's Here Map integration. I got the output like this and error

java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

enter image description here

My

Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.heremap"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="16" />
<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.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

<uses-library android:name="com.here.android" android:required="true" />
        <activity
            android:name="com.example.heremap.MainActivity"
            android:label="@string/app_name" >
            <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="XXXXXX"/>
<meta-data android:name="com.here.android.maps.apptoken"
android:value="XXXXXX"/>
    </application>

</manifest>

MainActivity.java

    package com.example.heremap;

import android.app.Activity;
import android.os.Bundle;

import com.here.android.mapping.FragmentInitListener;
import com.here.android.mapping.InitError;
import com.here.android.mapping.Map;
import com.here.android.mapping.MapAnimation;
import com.here.android.mapping.MapFactory;
import com.here.android.mapping.MapFragment;

public class MainActivity extends Activity {

    // map embedded in the map fragment
    private Map map = null;

    // map fragment embedded in this activity
    private MapFragment mapFragment = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Search for the map fragment to finish setup by calling init().
        mapFragment = (MapFragment) getFragmentManager().findFragmentById(
                R.id.mapfragment);
        mapFragment.init(new FragmentInitListener() {
            @Override
            public void onFragmentInitializationCompleted(InitError error) {
                if (error == InitError.NONE) {
                    // retrieve a reference of the map from the map fragment
                    map = mapFragment.getMap();
                    // Set the map center coordinate to the Vancouver region
                    map.setCenter(MapFactory.createGeoCoordinate(49.196261,
                            -123.004773, 0.0), MapAnimation.NONE);
                    // Set the map zoom level to the average between min and max
                    // (with no animation)
                    map.setZoomLevel((map.getMaxZoomLevel() +
                            map.getMinZoomLevel()) / 2);
                } else {
                    System.out.println("ERROR: Cannot initialize Map Fragment");
                }
            }
        });
    }
}

activity_main.xml

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world"
        tools:context=".MainActivity" />
<fragment
    class="com.here.android.mapping.MapFragment"
    android:id="@+id/mapfragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
</LinearLayout>

Error Log:

 02-26 06:06:47.192: E/AndroidRuntime(808): FATAL EXCEPTION: main 02-26
 06:06:47.192: E/AndroidRuntime(808): java.lang.IllegalAccessError:
 Class ref in pre-verified class resolved to unexpected implementation
 02-26 06:06:47.192: E/AndroidRuntime(808):     at
 com.example.heremap.MainActivity.onCreate(MainActivity.java:27) 02-26
 06:06:47.192: E/AndroidRuntime(808):   at
 android.app.Activity.performCreate(Activity.java:5180) 02-26
 06:06:47.192: E/AndroidRuntime(808):   at
 android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
 02-26 06:06:47.192: E/AndroidRuntime(808):     at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2031)
 02-26 06:06:47.192: E/AndroidRuntime(808):     at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2092)
 02-26 06:06:47.192: E/AndroidRuntime(808):     at
 android.app.ActivityThread.access$600(ActivityThread.java:133) 02-26
 06:06:47.192: E/AndroidRuntime(808):   at
 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
 02-26 06:06:47.192: E/AndroidRuntime(808):     at
 android.os.Handler.dispatchMessage(Handler.java:99) 02-26
 06:06:47.192: E/AndroidRuntime(808):   at
 android.os.Looper.loop(Looper.java:137) 02-26 06:06:47.192:
 E/AndroidRuntime(808):     at
 android.app.ActivityThread.main(ActivityThread.java:4807) 02-26
 06:06:47.192: E/AndroidRuntime(808):   at
 java.lang.reflect.Method.invokeNative(Native Method) 02-26
 06:06:47.192: E/AndroidRuntime(808):   at
 java.lang.reflect.Method.invoke(Method.java:511) 02-26 06:06:47.192:
 E/AndroidRuntime(808):     at
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
 02-26 06:06:47.192: E/AndroidRuntime(808):     at
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:559) 02-26
 06:06:47.192: E/AndroidRuntime(808):   at
 dalvik.system.NativeStart.main(Native Method)

After remove jar from order and export folder getting new error and updated log result

02-26 06:34:09.810: E/Trace(1266): error opening trace file: No such file or directory (2) 02-26 06:34:09.859: D/BYD_Flex(1266): getValue() name = @NOKIAFLEX@packageNeedData 02-26 06:34:09.859: D/BYD_Flex(1266): Couldn't find file variant/cfg/flex.xml 02-26 06:34:09.870: D/BYD_Flex(1266): getValue() readFlexFromXml = TypedValue{t=0x0/d=0x0} 02-26 06:34:09.870: D/BYD_Flex(1266): getValue() name = @NOKIAFLEX@setDataUsageReminder 02-26 06:34:09.870: D/BYD_Flex(1266): Couldn't find file variant/cfg/flex.xml 02-26 06:34:09.870: D/BYD_Flex(1266): getValue() readFlexFromXml = TypedValue{t=0x0/d=0x0} 02-26 06:34:10.249: I/Choreographer(1266): Skipped 44 frames! The application may be doing too much work on its main thread. 02-26 06:34:10.249: W/TextureView(1266): A TextureView or a subclass can only be used with hardware acceleration enabled. 02-26 06:34:10.459: I/Choreographer(1266): Skipped 53 frames! The application may be doing too much work on its main thread. 02-26 06:34:11.679: I/Choreographer(1266): Skipped 314 frames! The application may be doing too much work on its main thread. 02-26 06:34:30.191: I/Choreographer(1266): Skipped 38 frames! The application may be doing too much work on its main thread. 02-26 06:34:32.183: I/Choreographer(1266): Skipped 34 frames! The application may be doing too much work on its main thread. 02-26 06:35:00.068: I/Choreographer(1266): Skipped 35 frames! The application may be doing too much work on its main thread. 02-26 06:35:11.672: I/Choreographer(1266): Skipped 56 frames! The application may be doing too much work on its main thread.

Lupien answered 26/2, 2014 at 5:37 Comment(12)
Do you have an application identifier and an application token from the Nokia publishing tool?Silvanasilvano
@ManishDubey yes i got that and put those into manifestLupien
Can you share your logcat details here? Are you making map in your app by heremap services or porting Google Map to HereMap ?Silvanasilvano
Here Map is something new,Thanks for sharring nice question.Osteo
@Kedarnath Nice question got 2 downvotes unfortunately.Silvanasilvano
@ManishDubey i not seen error but display blankLupien
thanks for help&support @Kedarnath and ManishDubeyLupien
Are you trying to display map on device or emulator? If emulator it must have OpenGL ES 2.0 and if device it must have working internet connection.Silvanasilvano
@ManishDubey In Emulator,Nokia X not yet launchLupien
@appubala, you should upload the code in question. It helps others to catch errors soon. Also upload the error logs.Osteo
@appubala Please upload Activity code and logcat details if possible. Issue may be in fragment.Silvanasilvano
@ManishDubey i updatedLupien
L
7

Hi friends atlast i find the error,the errror is in the emulator,you must create emulator with this configenter image description here

After that add two jar in libraries

  • com.here.android.sdk.jar
  • com.google.android.maps.sdk.jar

enter image description here

and get output like this

enter image description here

Lupien answered 26/2, 2014 at 7:3 Comment(5)
Finally, problem was in emulator.It must be Nokia X Services based emulator.Silvanasilvano
@Appu, do I need to but publisher account to get Map-Keys ?Osteo
@Kedarnath to get key ->developer.nokia.com/nokia-x/nokia-apis/here-maps#keygen developer account is freeLupien
@appubala, I too successfully created Here Map Application. your answer helped me a lot. Thank you.Osteo
@Kedarnath it's only knowledge sharing,with all other's help only we spot out the errorLupien
P
1

Your minSdkVersion is 8 but from Official tutorial they told to set minSdkVersion to 11 see POINT NO 6 if u want to access that map in android-2.3 api level 10 then you have to use Support library

Pseudocarp answered 26/2, 2014 at 6:34 Comment(2)
i chaged that to 11 but not updated wait i update my questionLupien
clean and rebuild ur project once then run itPseudocarp
B
0

In general you get the black-control when the map control initialization fails, so you could check the initialization complete function, and see whether the error code would indicate what goes wrong, quite often it does tell the exact reason.

Busiek answered 26/2, 2014 at 7:26 Comment(6)
i tried and correct my error,i updated my answer,thanks for supportLupien
i getting trouble with nokia console console.push.nokia.com not getting inside,shows 404 error in websiteLupien
Try: console.push.nokia.com/ncm/Web/index.jsp I got forwarded to there when trying your linkBusiek
it says enter your details after that continue button,clicking that 404 error,i am not able to work on NCMLupien
Strange.. One trick would be to go to developer.nokia.com sign in with your account, and after signing in, try accessing the link.Busiek
And if that fails, then I would suggest emailing the support directly: notifications.support(at)nokia.comBusiek

© 2022 - 2024 — McMap. All rights reserved.