【问题标题】:Google maps app inflation exception谷歌地图应用通胀异常
【发布时间】:2014-03-31 14:03:40
【问题描述】:

我在访问应用程序的地图部分时不断出错 我在我的应用程序中包含了 google play services 依赖项,我还需要在其中包含任何其他库吗?如何添加库?网上所有的教程都用的是老版本的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);
}

}

【问题讨论】:

  • Taxitown.map 视图/片段的布局 xml 文件似乎存在问题。你能发布那个类和布局文件吗?
  • 我已经为你完成了

标签: google-maps android-studio


【解决方案1】:

我改用 MapView 并且效果很好!

【讨论】:

    猜你喜欢
    • 2018-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多