I have a file /res/values/maps_api_key.xml where I defined my Google Maps API key:
<resources>
<string name="maps_api_key">03xx123124exapmle4444444c9yA</string>
</resources>
This is the line of my application code which throws an error:
mMapView = new MapView(this, getString(R.string.maps_api_key));
This is the error:
maps_api_key cannot be resolved or is not a field
I have imported resources as:
import android.R;
Why this marked by Eclipse as an error?
You don’t have to
import android.R;, but be sure to include a string:at beginning of your .java file (replace with your actual package name ofcourse)