0

I just added an onCreateOptionsMenu to make an Action Bar for my app. The action bar is working, however the map fragment doesn't fully load. Whereas before it did so. It shows just grey where the map should be. Although the fragment is clearly there, ebcause of the zoom and location icons.

public class MainActivity extends Activity {

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu items for use in the action bar
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main_activity_actions, menu);
    return super.onCreateOptionsMenu(menu);
}



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




    // Get a handle to the xml Map Fragment
    GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(
            R.id.map)).getMap();


 ...

Here is the xml

<LinearLayout 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="${relativePackage}.${activityClass}" >

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


 </LinearLayout>

logcat

08-27 21:49:38.524: W/GA-SERVICE(1368): Thread[Thread-1969,5,main]: Exception sending hit: HttpHostConnectException

08-27 21:49:38.524: W/GA-SERVICE(1368): Thread[Thread-1969,5,main]: Connection to https://ssl.google-analytics.com refused

08-27 21:49:38.524: W/GA-SERVICE(1368): Thread[Thread-1969,5,main]: Empty hitIds passed to deleteHits.

08-27 21:49:39.625: D/ActivityThread(29611): handleBindApplication:com.google.android.gms.maps

08-27 21:49:39.625: D/ActivityThread(29611): setTargetHeapUtilization:0.75

08-27 21:49:39.625: D/ActivityThread(29611): setTargetHeapMinFree:2097152

08-27 21:49:39.645: I/MultiDex(29611): install

08-27 21:49:39.645: I/MultiDex(29611): MultiDexExtractor.load(/data/app/com.google.android.gms-2.apk, false)

08-27 21:49:39.655: I/MultiDex(29611): loading existing secondary dex files

08-27 21:49:39.655: I/MultiDex(29611): load found 1 secondary dex files

08-27 21:49:39.655: I/MultiDex(29611): install done

08-27 21:49:39.675: I/ProviderInstaller(29611): Insert disabled by gate 'gms:security:enable_conscrypt_in_gms_application'

user2974706
  • 63
  • 1
  • 1
  • 12

2 Answers2

0

backend is not set up properly so nothing is being loaded into to map fragment, check your console to see if your maps api is enabled and your package is the same as the one specified in the console etc, i recommend you go through https://www.youtube.com/watch?v=awX5T-EwLPc

steff_bdh
  • 1,108
  • 2
  • 15
  • 32
  • I should have added that it worked beforehand. The map fragment loaded properly. That is all set up elsewhere. I added the onCreateOptionsMenu and it stopped working. – user2974706 Aug 27 '14 at 21:10
0

I don't think you should be connecting to a analytics at all. Are you using some kind of ads?

This answer seems to be related: google analytics easytracker causes java connection exception

Community
  • 1
  • 1
Simas
  • 43,548
  • 10
  • 88
  • 116