Problem with simple map

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Problem with simple map

Postby Menor » Fri Apr 15, 2011 3:15 pm

Hello, i'm starting with android.

I'm trying to create a MapView, but i'm not getting it.

First, i couldn't extends MapActivity on my main class, so, i added the maps library: Right click on project, proprierties, java build path, libraries, add external jars.

I selected the jar on this folder... C:\android-sdk\add-ons\addon_google_apis_google_inc_8\libs\maps.jar

I'll show you my code.

The manifest:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.cc.testingmaps"
      android:versionCode="1"
      android:versionName="1.0">
    <!-- Permissões GPS -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.Light">

        <!-- Maps -->
        <uses-library android:name="com.google.android.maps" />
         <activity android:name=".TestingMaps"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="8" />
</manifest>


main.xml
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <com.google.android.maps.MapView
        android:id="@+id/mapView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:enabled="true"
        android:clickable="true"
        android:apiKey="0xMXkuxFNGrhQ2hZiyf7HJ-XZl3w3Nq43_Z8DZw"
        />
</RelativeLayout>


TestingMaps.java
Code: Select all
package com.cc.testingmaps;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

import android.os.Bundle;

public class TestingMaps extends MapActivity {
   
    private MapView mapView;
    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
       
        mapView = (MapView) findViewById(R.id.mapView);
        setContentView(mapView);
    }

    @Override
    protected boolean isRouteDisplayed() {
        return false;
    }
}



===

On a real device, the error is:
Code: Select all
04-15 10:47:16.468: ERROR/AndroidRuntime(19429): FATAL EXCEPTION: main

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at dalvik.system.DexFile.defineClass(Native Method)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:207)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:200)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at android.app.ActivityThread.access$1500(ActivityThread.java:117)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at android.os.Handler.dispatchMessage(Handler.java:99)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at android.os.Looper.loop(Looper.java:123)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at android.app.ActivityThread.main(ActivityThread.java:3683)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at java.lang.reflect.Method.invokeNative(Native Method)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at java.lang.reflect.Method.invoke(Method.java:507)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)

04-15 10:47:16.468: ERROR/AndroidRuntime(19429): at dalvik.system.NativeStart.main(Native Method)




On AVD the error is:
Code: Select all
[2011-04-15 10:50:25 - TestingMaps] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2011-04-15 10:50:25 - TestingMaps] Please check logcat output for more details.
[2011-04-15 10:50:25 - TestingMaps] Launch canceled!


Anyone knows what is going wrong?
Menor
Experienced Developer
Experienced Developer
 
Posts: 83
Joined: Mon Apr 11, 2011 3:45 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 3 guests