MapView does not display a map (arcgis-android:100.1.0)

2822
3
Jump to solution
10-18-2017 11:01 AM
DavidHoxeng
New Contributor

I have ran the samples from GitHub and the map displays as it should (running the display-map project)

However when I try to implement the same in my own project, the map show this:Just a blank map

Here is my implementation on the activity for the map:

public class ArcGISMapActivity extends AppCompatActivity {

    private MapView mMapView;

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

        mMapView = (MapView) findViewById(R.id.mapView);
        ArcGISMap map = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 34.056295, -117.195800, 16);
        mMapView.setMap(map);
    }


    @Override
    protected void onPause(){
        mMapView.pause();
        super.onPause();
    }

    @Override
    protected void onResume(){
        super.onResume();
        mMapView.resume();
    }

}

Here is the manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="XXXXXXXXXXXXXXXXXXXXX">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <uses-permission android:name = "andriod.permission.CALL_PHONE" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-feature android:glEsVersion="0x00020000" android:required="true"/>

        <activity android:name=".activities.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

The activity is called from the home screen using a standard intent call:

Intent intent = new Intent(getApplicationContext(), ArcGISMapActivity.class);
startActivity(intent);


Seeing that the sample runs, I am guessing that I am missing something, but I can not for the life of me figure out what it is.  Any help would be awesome!

0 Kudos
1 Solution

Accepted Solutions
AlexanderNohe1
Occasional Contributor III

You have the permissions in the wrong location.  They should be outside the application tag.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="XXXXXXXXXXXXXXXXXXXXX">

        <uses-permission android:name = "andriod.permission.CALL_PHONE" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-feature android:glEsVersion="0x00020000" android:required="true"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity android:name=".activities.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

This documentation specified that is should be contained within the Manifest tag, not the application tag : | Android Developers 

I hope this helps!

View solution in original post

3 Replies
AlexanderNohe1
Occasional Contributor III

You have the permissions in the wrong location.  They should be outside the application tag.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="XXXXXXXXXXXXXXXXXXXXX">

        <uses-permission android:name = "andriod.permission.CALL_PHONE" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-feature android:glEsVersion="0x00020000" android:required="true"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity android:name=".activities.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

This documentation specified that is should be contained within the Manifest tag, not the application tag : | Android Developers 

I hope this helps!

DavidHoxeng
New Contributor

That was it. What a rookie mistake!! That is what happens when you stay up too late coding! I just needed a set of eyes on it.  Thank you so much!

0 Kudos
AlexanderNohe1
Occasional Contributor III

Would you kindly mark mine as the correct answer if it assisted in resolving this issue?