• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Google MapView tutorial Problem

babyboss

Lurker
Dec 11, 2010
6
0
I got the following error from LogCat after run the first part of google mapview tutorial from android developer.

Code:
12-13 00:20:12.828: ERROR/AndroidRuntime(521): java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at dalvik.system.DexFile.defineClass(Native Method)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:209)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:203)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at android.os.Looper.loop(Looper.java:123)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at android.app.ActivityThread.main(ActivityThread.java:4627)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at java.lang.reflect.Method.invokeNative(Native Method)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at java.lang.reflect.Method.invoke(Method.java:521)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-13 00:20:12.828: ERROR/AndroidRuntime(521):     at dalvik.system.NativeStart.main(Native Method)
-----------------------------------------------------------------------
Mainfest.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="[URL]http://schemas.android.com/apk/res/android[/URL]"
      package="com.example.hellogooglemap"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">    
     <uses-library android:name="com.google.android.maps" />
        <activity android:name=".HelloGoogleMap"
                  android:label="@string/app_name"
                  android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
 <uses-permission android:name="android.permission.INTERNET" />
</manifest>

/layout/main.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
    xmlns:android="[URL]http://schemas.android.com/apk/res/android[/URL]"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:apiKey="Your API Key"
/>

HelloGoogleMap.java
Code:
package com.example.hellogooglemap;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
public class HelloGoogleMap extends MapActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
 
        MapView mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
    }
    @Override
    protected boolean isRouteDisplayed() {
        return false;
    }
}
 
First of all, thank you very much for the attachment. It works, and it doesn't show me stopped unexpectedly error. However, I get blank google map page, which doesn't show anything like the following:
7dbb6010efff3a1cfa19b865.jpg



By the way, I am in Asia region. Will that also be a factor?
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones