0

I am trying to make a Google Map appear on an Android application (version 4.4). But I keep getting the following errors:

07-28 21:59:57.399: E/Trace(17454): error opening trace file: No such file or directory      (2)
07-28 21:59:57.419: W/dalvikvm(17454): Refusing to reopen boot DEX  '/system/framework/hwframework.jar'
07-28 21:59:57.829: I/System.out(17454): android.view.InflateException: Binary XML file   line #9: Error inflating class fragment
07-28 21:59:58.239: I/Adreno200-EGL(17454): <qeglDrvAPI_eglInitialize:299>: EGL 1.4   QUALCOMM build:     AU_LINUX_ANDROID_JB_REL_2.0.3.04.01.01.21.010_msm8625_JB_REL_2.0.3_Merge_release_AU (Merge)
07-28 21:59:58.239: I/Adreno200-EGL(17454): Build Date: 10/26/12 Fri
07-28 21:59:58.239: I/Adreno200-EGL(17454): Local Branch: 
07-28 21:59:58.239: I/Adreno200-EGL(17454): Remote Branch: quic/jb_rel_2.0.3
07-28 21:59:58.239: I/Adreno200-EGL(17454): Local Patches: NONE
07-28 21:59:58.239: I/Adreno200-EGL(17454): Reconstruct Branch:AU_LINUX_ANDROID_JB_REL_2.0.3.04.01.01.21.010 +  NOTHING

Here is my MainActivity:

package com.esuohetihwmot.bagelmania;

import com.esuohetihwmot.bagelmania.R;
import com.google.android.gms.maps.GoogleMap;
import android.support.v7.app.ActionBarActivity;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;



public class MainActivity extends ActionBarActivity {

public GoogleMap map;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try{
    setContentView(R.layout.map);
    }catch(Exception ex){
        System.out.println(ex); 
    }
}



@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, 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);
}

/**
 * A placeholder fragment containing a simple view.
 */
public static class PlaceholderFragment extends Fragment {

    public PlaceholderFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main, container, false);
        return rootView;
    }
}

}

Here is my map.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<fragment
      android:id="@+id/map"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:name="com.google.android.gms.maps.MapFragment"/>

And lastly, here is my Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.esuohetihwmot.bagelmania"
android:versionCode="1"
android:versionName="1.0" >

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true"/>


<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="20" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="....Pksl3Y"/>

    <meta-data android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

</application>

</manifest>

I'm sorry if I have laid this out wrong or haven't posted correctly, but I would really appreciate the help.

9
  • Did you try to change the fragment android:name attribute to "com.google.android.gms.maps.SupportMapFragment" instead? Commented Jul 28, 2014 at 21:15
  • @joao2fast4u Still gives me the same error. Commented Jul 28, 2014 at 21:19
  • Where are you running your code? Commented Jul 28, 2014 at 21:21
  • @joao2fast4u on a HUAWEI Commented Jul 28, 2014 at 21:22
  • Is your app crashing or does it simply displays that message in LogCat? Commented Jul 28, 2014 at 21:23

1 Answer 1

1

Turns out that you had misnamed the package name at your source code and some layout files, and it was not the same as the one declared in your manifest file. It was possibly creating that error. Now, with the same package name everywhere, everything will work ok.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.