1. Wir haben diesmal 2 Gewinnspiele zeitgleich für euch - Gewinne einmal ein UMI Plus E - Beim 2ten könnt ihr ein Nomu S30 gewinnen!
  1. micha91, 23.02.2011 #1
    micha91

    micha91 Threadstarter Neuer Benutzer

    Hallo,

    ich versuche derzeit google Maps in meiner App anzuzeigen. Allerdings bekomme ich einen Laufzeitfehler.
    LogCat dokumentiert folgendes:

    Code:
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227): FATAL EXCEPTION: main
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.TestActivity/com.TestActivity.karteAnzeigen}: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.android.maps.MapView
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2833)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2854)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.app.ActivityThread.access$2300(ActivityThread.java:136)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2179)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.os.Handler.dispatchMessage(Handler.java:99)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.os.Looper.loop(Looper.java:143)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.app.ActivityThread.main(ActivityThread.java:5068)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at java.lang.reflect.Method.invokeNative(Native Method)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at java.lang.reflect.Method.invoke(Method.java:521)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at dalvik.system.NativeStart.main(Native Method)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.android.maps.MapView
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.view.LayoutInflater.createView(LayoutInflater.java:513)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:215)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.app.Activity.setContentView(Activity.java:1686)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at com.TestActivity.karteAnzeigen.onCreate(karteAnzeigen.java:16)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1066)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2797)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     ... 11 more
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227): Caused by: java.lang.reflect.InvocationTargetException
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at com.google.android.maps.MapView.<init>(MapView.java:238)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at java.lang.reflect.Constructor.constructNative(Native Method)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at android.view.LayoutInflater.createView(LayoutInflater.java:500)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     ... 21 more
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227): Caused by: java.lang.IllegalArgumentException: MapViews can only be created inside instances of MapActivity.
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at com.google.android.maps.MapView.<init>(MapView.java:282)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     at com.google.android.maps.MapView.<init>(MapView.java:255)
    02-23 11:18:40.304: ERROR/AndroidRuntime(17227):     ... 25 more
    02-23 11:18:40.324: WARN/ActivityManager(1293):   Force finishing activity com.TestActivity/.karteAnzeigen
    02-23 11:18:40.324: WARN/ActivityManager(1293):   Force finishing activity com.TestActivity/.TestActivity
    
    
    Meine karteAnzeigen.xml:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
    	xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/mainlayout"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    <com.google.android.maps.MapView
    	android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="Mein_API_Key">
    </com.google.android.maps.MapView>
    </RelativeLayout>

    karteAnzeigen.java:

    Code:
    package com.TestActivity;
    
    
    
    import android.os.Bundle;
    
    public class karteAnzeigen extends MapActivity
    {
    	protected boolean isRouteDisplayed() {
    	    return false;
    	}
    	
    	public void onCreate(Bundle savedInstanceState) 
    	{
    	    super.onCreate(savedInstanceState);
    	    setContentView(R.layout.karte_anzeigen);
    	    
    	}
    }
    
    AndroidManifest.xml
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.TestActivity"
          android:versionCode="1"
          android:versionName="1.0">
    <uses-library android:name="com.google.android.maps"/>
    	<uses-permission android:name="android.permission.INTERNET"/>
        <application android:icon="@drawable/icon" android:label="@string/app_name">
            <activity android:name=".TestActivity"
                      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>
    		<activity android:name=".karteAnzeigen"></activity>
    		<activity android:name=".kontakteAnzeigen"></activity>
    		<activity android:name=".androidMarket"></activity>
    		<activity android:name=".MapActivity"></activity>
    		<uses-library android:name="com.google.android.maps"></uses-library>
        </application>
    </manifest>

    hat vielleicht jemand einen Tip für mich?
     
  2. ThoRsHammeR12, 23.02.2011 #2
    ThoRsHammeR12

    ThoRsHammeR12 Neuer Benutzer

  3. micha91, 23.02.2011 #3
    micha91

    micha91 Threadstarter Neuer Benutzer

    ich habs genau so gemacht. aber leider funktioniert's nicht ganz. warum auch immer.
     
  4. micha91, 02.03.2011 #4
    micha91

    micha91 Threadstarter Neuer Benutzer

    also entweder bin ich zu doof, des funktioniert einfach nicht.
    Was hat es genau mit dieser MapActivity auf sich? und was muss ich da eintragen? Ich komm einfach nicht weiter. Kann mir keiner helfen?