Android NokiaX Emulator Google Maps, MapActivity, error opening trace file: No such file or directory

StackOverflow https://stackoverflow.com/questions/23439032

Pergunta

I am trying to port my Android project carEgiri to NokiaX. I am getting this exception

05-02 04:57:19.989: E/Trace(1928): error opening trace file: No such file or directory (2)
05-02 04:57:19.989: E/AndroidRuntime(1928): FATAL EXCEPTION: main
05-02 04:57:19.989: E/AndroidRuntime(1928): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mcruiseon.pune.nokiax.caregiri/com.mcruiseon.caregiri.Registration}: java.lang.RuntimeException: stub
05-02 04:57:19.989: E/AndroidRuntime(1928):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1991)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2092)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at android.app.ActivityThread.access$600(ActivityThread.java:133)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at android.os.Looper.loop(Looper.java:137)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at android.app.ActivityThread.main(ActivityThread.java:4807)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at java.lang.reflect.Method.invokeNative(Native Method)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at java.lang.reflect.Method.invoke(Method.java:511)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:559)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at dalvik.system.NativeStart.main(Native Method)
05-02 04:57:19.989: E/AndroidRuntime(1928): Caused by: java.lang.RuntimeException: stub
05-02 04:57:19.989: E/AndroidRuntime(1928):     at com.google.android.maps.MapActivity.<init>(Unknown Source)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at com.mcruiseon.caregiri.Registration.<init>(Registration.java:48)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at java.lang.Class.newInstanceImpl(Native Method)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at java.lang.Class.newInstance(Class.java:1319)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
05-02 04:57:19.989: E/AndroidRuntime(1928):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1982)
05-02 04:57:19.989: E/AndroidRuntime(1928):     ... 11 more
05-02 04:57:22.790: E/SWIPE(1078): clear()

Manifest file has (relevant section)

<application
        android:allowBackup="true"
        android:hardwareAccelerated="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >

        <!--
             <uses-library
            android:name="com.google.android.maps"
            android:required="true" />
        -->

        <uses-library
            android:name="com.here.android"
            android:required="false" />

        <meta-data
            android:name="com.here.android.maps.appid"
            android:value="code" />
        <meta-data
            android:name="com.here.android.maps.apptoken"
            android:value="code" />

        <activity
            android:name="com.mcruiseon.caregiri.Registration"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:windowSoftInputMode="adjustPan" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

            <meta-data
                android:name="isCarEgiri"
                android:value="true" />
        </activity>

My code uses MapActivity,

  • Do I need to rewrite some code to not use MapActivity (from com.google.android.maps), and instead use here api's ?
  • My emulator currently uses 4.1.2 Nokia X as target.
  • The app fails to install if I uncomment

    -->

Which means, that nokia emulator DOES NOT support com.google.android.maps, API's.

Foi útil?

Solução

I was looking through the nokia sdk update on the android sdk folder (extras folder). I wondered why com.google.android.maps.jar was provided as part of the Nokia SDK. On a hunch, I got my project to use Nokia X 4.1.2 (Settings-Android), copied only the com.google.android.maps.jar to the libs folder of my project. Initialised here maps in my manifest file. And now the app loads.

I crashed, and I googled and found http://developer.nokia.com/community/discussion/showthread.php/245545-Porting-Google-Maps-v2-to-HERE-Maps-gt-Error-initializing-map-problem-with-disk-cach

Now, my app works.

There is no need to use HERE MAPS library, google api's with the reference_v2 import should work.

Outras dicas

Basically there are two ways you can port your Google Maps v1 application to be using HERE maps.

  1. By using the HERE Wrapper library providing the same namespace implementation as google does, Steps for porting are explained in the documentation. This would produce a new APK which would only run in Nokia X devices

  2. By using the HERE Wrapper library, which is provided under nokia-namespace, partially documented in the documentation, an example for it would be at Github

The steps for the 2 option would in general be:

  1. Modify Manifest file to include all HERE required stuff (see option 1 docs for details, remember to only set the required flag for google maps to false, but still keep the lines in)

  2. Add the library into your project (get it from github)

  3. Copy the layout used with google maps, rename it, and replace all google namespace items to be using nokia namespece instead. Do remember to change the any id's also.

  4. Copy the java implementation of the class using the Google maps, rename it, and replace all google imports with nokia-namespace imports, remember also change layout to be using the one made in step3.

  5. Implement the runtime logic for selecting which maps offering is used. Example for it is shown in docs

The option 2 would then create APK which you could run both in Nokia X devices, as well as others supporting Google maps v1.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top