2014-09-23 16 views
5

Sto tentando di utilizzare mapbox nella mia applicazione Android. Io uso Android Studio 0.8.0. Ho incluso questa linea nella mia build.gradle il fileErrore durante l'analisi dell'XML: prefisso non associato per mapbox

compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:[email protected]'){ 
     transitive=true 
    } 
    compile ('com.cocoahero.android:geojson:[email protected]'){ 
     transitive=true 
    } 

Ma quando sto usando nel mio file xml, ha un errore di spazio dei nomi. lo spazio dei nomi mapbox lo fa. qualche idea di cosa potrebbe causare quello?

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/parent_layout"> 
    <LinearLayout 
     android:orientation="vertical" android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:textSize="15sp" 
      android:text="this is the general tab"/> 
     <com.mapbox.mapboxsdk.views.MapView -->not causing error 
      android:id="@+id/mapview" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      mapbox:mapid="Your MapBox mapid" /> -->causing error 
    </LinearLayout> 
</ScrollView> 
+1

provare a mettere solo mapid = "la vostra tasto ID mappa " – Psypher

risposta

4

ok, finalmente è risolto. A cambiare il mio file xml:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/parent_layout"> 
    <com.mapbox.mapboxsdk.views.MapView 
     android:id="@+id/mapid" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:paddingTop="10dp" 
     app:mapid="your map id" 
     android:layout_width="match_parent" 
     android:layout_height="320dp" > 
    </com.mapbox.mapboxsdk.views.MapView> 
</ScrollView> 
+0

evviva. questo ha aiutato – jonney

+0

grande, che ha risolto il mio problema –

+0

@ stephen1706 im anche ottenere lo stesso errore problema: Nessun identificatore di risorsa trovata per l'attributo 'mapid' a pacchetto 'com.example.mapbox' – Erum

6

È inoltre possibile risolvere questo errore con l'aggiunta di questa linea nel vostro xml: esempio

xmlns:mapbox="http://schemas.android.com/apk/res-auto" 

XML:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:mapbox="http://schemas.android.com/apk/res-auto" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 


    <com.mapbox.mapboxsdk.views.MapView 
     android:id="@+id/mapview" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     mapbox:mapid="your id" /> 

</LinearLayout> 
Problemi correlati