2014-03-31 36 views
0

我在訪問應用程序的地圖部分時總是收到錯誤 我在我的應用程序中包含谷歌播放服務依賴項是否有我需要包含在其中的任何其他庫?我如何添加庫?互聯網上的所有教程都使用舊版本的android studio,而我使用最新版本的教程。谷歌地圖應用程序通貨膨脹異常

enter code here 
FATAL EXCEPTION: main 
"java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.zeda.TaxiTown/com.zeda.TaxiTown.map}: 
android.view.InflateException: Binary XML file line #18: Error inflating class fragment" 

在我的android地圖應用程序中是什麼意思?

XML

<?xml version="1.0" encoding="utf-8"?> 

<!-- This can go anywhere in your layout (see other demos for some examples). --> 
<fragment xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/map" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
class="com.google.android.gms.maps.SupportMapFragment"/> 

JAVA文件有這它 包com.zeda.TaxiTown;

import android.support.v7.app.ActionBarActivity; 
import android.os.Bundle; 
import android.view.Menu; 
import android.view.MenuItem; 


public class map extends ActionBarActivity { 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_map); 
} 


@Override 
public boolean onCreateOptionsMenu(Menu menu) { 

    // Inflate the menu; this adds items to the action bar if it is present. 
    getMenuInflater().inflate(R.menu.map, menu); 
    return true; 
} 

@Override 
public boolean onOptionsItemSelected(MenuItem item) { 
    // Handle action bar item clicks here. The action bar will 
    // automatically handle clicks on the Home/Up button, so long 
    // as you specify a parent activity in AndroidManifest.xml. 
    int id = item.getItemId(); 
    if (id == R.id.action_settings) { 
     return true; 
    } 
    return super.onOptionsItemSelected(item); 
} 

} 
+0

它看起來是Taxitown.map視圖/片段的佈局xml文件的問題。 你可以發佈該類和佈局文件嗎? – athor

+0

那裏我已經爲你做了 –

回答

0

我轉而使用MapView,它的工作原理!