4

Nokia の Here Map 統合については、このチュートリアルのリンクに従ってください。このような出力とエラーが得られました

java.lang.IllegalAccessError: 検証済みクラスのクラス参照が予期しない実装に解決されました

ここに画像の説明を入力

じぶんの

マニフェスト.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>

エラーログ:

 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)

注文からjarを削除し、フォルダをエクスポートすると 、新しいエラーと更新されたログ結果が得られます

02-26 06:34:09.810: E/Trace(1266): トレース ファイルを開く際のエラー: そのようなファイルまたはディレクトリはありません (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): ファイル 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() 名前 = @NOKIAFLEX@setDataUsageReminder 02-26 06:34:09.870: D/BYD_Flex (1266): ファイル 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: 私/Choreographer(1266): 44 フレームスキップしました! アプリケーションがメイン スレッドで処理しすぎている可能性があります。02-26 06:34:10.249: W/TextureView(1266): TextureView またはサブクラスは、ハードウェア アクセラレーションが有効になっている場合にのみ使用できます。02-26 06:34:10.459: 私/コレオグラファー (1266): 53 フレームスキップしました! アプリケーションがメイン スレッドで処理しすぎている可能性があります。02-26 06:34:11.679: 私/Choreographer(1266): 314 フレームスキップしました! アプリケーションがメイン スレッドで処理しすぎている可能性があります。02-26 06:34:30.191: 私/コレオグラファー(1266): 38 フレームスキップしました! アプリケーションがメイン スレッドで処理しすぎている可能性があります。02-26 06:34:32.183: 私/コレオグラファー(1266): 34 フレームスキップしました! アプリケーションがメイン スレッドで処理しすぎている可能性があります。02-26 06:35:00.068: 私/コレオグラファー(1266): 35 フレームスキップしました! アプリケーションがメイン スレッドで処理しすぎている可能性があります。02-26 06:35:11.672: 私/コレオグラファー (1266): 56 フレームスキップしました!

4

4 に答える 4

5

こんにちは、最後にエラーを見つけました。エラーはエミュレーターにあります。この構成でエミュレーターを作成する必要があります。ここに画像の説明を入力

その後、ライブラリに2つのjarを追加します

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

ここに画像の説明を入力

このような出力を取得します

ここに画像の説明を入力

于 2014-02-26T07:03:25.927 に答える
1

サードパーティのライブラリ参照が 2 回追加されたため、このエラーが発生しています。プロジェクトのビルド パスにアプリケーション パスを追加しました。そのため、ライブラリ参照は自動的にプロジェクトに追加されます」。プロパティ-> Androidの下のテストプロジェクトのライブラリ参照を削除します。EclipseのプロジェクトのJavaビルドパスの下にある「注文とエクスポート」タブからjarのチェックを外します。しかし、それらは「ライブラリ」に追加されます" タブ。[OK]、[Clean projects and build now] の順にクリックします。動作します。

エラーの場合

       error opening trace file: No such file or directory (2)

Android 仮想デバイスを再作成し、SD カード サイズの値を確実に入力します (200 MiB を使用しました)。

ここに画像の説明を入力

于 2014-02-26T06:23:04.837 に答える
1

しかし、公式チュートリアルminSdkVersion is 8から、そのマップにアクセスしたい場合はポイント6を参照するように設定するように言われましたが、サポートライブラリを使用する必要がありますminSdkVersion to 11android-2.3 api level 10

于 2014-02-26T06:34:30.883 に答える
0

一般に、マップ コントロールの初期化が失敗したときにブラック コントロールを取得するため、初期化完了関数を確認し、エラー コードが何が問題なのかを示しているかどうかを確認できます。多くの場合、正確な理由が示されます。

于 2014-02-26T07:26:25.633 に答える