내가 NullPointerException이NullPointerException가 언제 장소 표시의 방법으로 구글 맵에 마커를 배치 할 때
NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference`
I/DpmTcmClient: RegisterTcmMonitor from: org.apache.http.impl.conn.TcmIdleTimerMonitor
W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:2
I/DynamiteModule: Selected remote version of com.google.android.gms.googlecertificates, version >= 2
D/GoogleCertificates: com.google.android.gms.googlecertificates module is loaded
E/url: http://maps.googleapis.com/maps/api/geocode/json?latlng=35.7742618,51.3596331&sensor=true
E/Lat Long to Addresss:
E/Googlemap: null
D/GoogleCertificatesImpl: Fetched 363 Google certificates
I/b: Sending API token request.
E/b: Authentication failed on the server.
E/Google Maps Android API: Authorization failure
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
이 또한 내가 getAsyncMap과 OnMapReady가(). 내부 OnMapReady 내가 Asynktask를 호출 익숙해 구글 맵 V2에 마커를 배치하려고 사용자의 위치를 확인하고 onPostExecute 장소 표시 방법은 호출 : 나는 또한 PLS이 link 그리고 012,325에 전체 전체 활동 확인) getAsyncMap로하여 getMap()을 (변경하려고 할 때
public void placeMarker(LatLongDetails user_latlongobj2,
final Context contextPlace) {
try {
if (googlemap == null) {
intialiseMap();
animatecamera(user_latlongobj);
}
if (LoginDetails.Address.length() < 1) {
LoginDetails.Address = "Getting your location .....";
}
googlemap.clear();
marker = new MarkerOptions().position(
new LatLng(user_latlongobj2.user_latitude,
user_latlongobj2.user_longitude)).title(
LoginDetails.Address);
System.out.println("This is the Address" + LoginDetails.Address);
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker));
googlemap.addMarker(marker).showInfoWindow();
System.out.println("PLACING MARKER" + LoginDetails.Address);
if (marker == null || contextPlace == null) {
Intent in =new Intent(this,ProfileActivity1.class);
in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
in.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(in);
}
else
fixmarker(marker, contextPlace);
} catch (Exception e) {
fixmarker(marker, contextPlace);
Log.d("Profileactivity", "" + e);
}
}
이러한 모든 문제가 함께했다
28,나는 error.here가 로그 캣입니다에 대한 자세한 내용을 찾기 위해 시도 및 캐치를 제거 :
enter code herejava.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
at android.content.ContextWrapper.getResources(ContextWrapper.java:87)
at android.view.ContextThemeWrapper.getResources(ContextThemeWrapper.java:81)
at android.support.v7.app.AppCompatActivity.getResources(AppCompatActivity.java:551)
at android.content.Context.getString(Context.java:413)
at com.example.cabbookinghome.ProfileActivity1.intialiseMap(ProfileActivity1.java:280)
at com.example.cabbookinghome.ProfileActivity1.placeMarker(ProfileActivity1.java:327)
at epbit.helper.ConversionTaskLatLonLoc.onPostExecute(ConversionTaskLatLonLoc.java:130)
at epbit.helper.ConversionTaskLatLonLoc.onPostExecute(ConversionTaskLatLonLoc.java:24)
at android.os.AsyncTask.finish(AsyncTask.java:651)
at android.os.AsyncTask.access$500(AsyncTask.java:180)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
at android.os.Handler.dispatchMessage(Handler.java:102)
에서하지 액세스 할 수있는 조각하는 방법입니다. – Raghavendra
나는 logcat을 추가했다. –
NLP와 함께 logcat에서 E/Google Maps Android API : Authorization failure "Google Maps Android API v2"가 활성화되어 있는지 확인하십시오. Google의 콘솔을 확인해주세요. – Raghavendra