Issue
I've already tried bunch of ways to get it working but every time I have an issue where I got an crash in MapView oncreate command. I have no idea what I'm doing wrong...
Fragment execution:
FragmentManager sFm = getSupportFragmentManager();
sFm.beginTransaction().replace(R.id.content_main, new MapHandler()).commit();
Fragment class:
public class MapHandler extends Fragment implements OnMapReadyCallback{
MapView mapView;
GoogleMap map;
@Override public void onDetach() {
super.onDetach();
}
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
}
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.activity_maps, container, false);
switch (GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity()) )
{
case ConnectionResult.SUCCESS:
Toast.makeText(getActivity(), "SUCCESS", Toast.LENGTH_SHORT).show();
mapView = new MapView(getContext());
mapView = (MapView) v.findViewById(R.id.map);
mapView.onCreate(savedInstanceState);
// Gets to GoogleMap from the MapView and does initialization stuff
if(mapView!=null)
{
mapView.getMapAsync(this);
}
break;
case ConnectionResult.SERVICE_MISSING:
Toast.makeText(getActivity(), "SERVICE MISSING", Toast.LENGTH_SHORT).show();
break;
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
Toast.makeText(getActivity(), "UPDATE REQUIRED", Toast.LENGTH_SHORT).show();
break;
default: Toast.makeText(getActivity(), GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity()), Toast.LENGTH_SHORT).show();
}
return v;
}
@Override
public void onPause() {
super.onPause();
mapView.onPause();
}
@Override
public void onDestroy() {
super.onDestroy();
mapView.onDestroy();
}
@Override public void onSaveInstanceState(Bundle outState)
{
super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState);
}
@Override public void onLowMemory()
{
super.onLowMemory();
mapView.onLowMemory();
}
@Override public void onResume() {
super.onResume();
mapView.onResume();
}
@Override public void onDestroyView() {
super.onDestroyView();
}
@Override public void onMapReady(GoogleMap googleMap)
{
}}
XML with MapView:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="2">
<com.google.android.gms.maps.MapView android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" />
</LinearLayout>
LogCat:
03-23 10:15:27.979 19412-19412/com.geoida.progeo I/art: Late-enabling -Xcheck:jni
03-23 10:15:28.030 19412-19425/com.geoida.progeo E/HAL: load: id=gralloc != hmi->id=gralloc
03-23 10:15:28.094 19412-19412/com.geoida.progeo W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.geoida.progeo-2/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/arm64/data@[email protected]@[email protected]) because non-0 exit status
03-23 10:15:28.564 19412-19412/com.geoida.progeo W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.geoida.progeo-2/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/arm64/data@[email protected]@[email protected]) because non-0 exit status
03-23 10:15:28.624 19412-19412/com.geoida.progeo W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.geoida.progeo-2/split_lib_slice_1_apk.apk --oat-file=/data/dalvik-cache/arm64/data@[email protected]@[email protected]) because non-0 exit status
03-23 10:15:28.677 19412-19412/com.geoida.progeo W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.geoida.progeo-2/split_lib_slice_2_apk.apk --oat-file=/data/dalvik-cache/arm64/data@[email protected]@[email protected]) because non-0 exit status
03-23 10:15:28.729 19412-19412/com.geoida.progeo W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.geoida.progeo-2/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/arm64/data@[email protected]@[email protected]) because non-0 exit status
03-23 10:15:28.783 19412-19412/com.geoida.progeo W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.geoida.progeo-2/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/arm64/data@[email protected]@[email protected]) because non-0 exit status
03-23 10:15:28.837 19412-19412/com.geoida.progeo W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.geoida.progeo-2/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/arm64/data@[email protected]@[email protected]) because non-0 exit status
03-23 10:15:28.887 19412-19412/com.geoida.progeo W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.geoida.progeo-2/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/arm64/data@[email protected]@[email protected]) because non-0 exit status
03-23 10:15:28.938 19412-19412/com.geoida.progeo W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.geoida.progeo-2/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/arm64/data@[email protected]@[email protected]) because non-0 exit status
03-23 10:15:28.997 19412-19412/com.geoida.progeo W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.geoida.progeo-2/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/arm64/data@[email protected]@[email protected]) because non-0 exit status
03-23 10:15:29.059 19412-19412/com.geoida.progeo W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.geoida.progeo-2/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/arm64/data@[email protected]@[email protected]) because non-0 exit status
03-23 10:15:29.061 19412-19412/com.geoida.progeo W/System: ClassLoader referenced unknown path: /data/app/com.geoida.progeo-2/lib/arm64
03-23 10:15:29.067 19412-19412/com.geoida.progeo I/InstantRun: Starting Instant Run Server for com.geoida.progeo
03-23 10:16:10.557 19412-19412/com.geoida.progeo I/HwCust: Constructor found for class android.app.HwCustHwWallpaperManagerImpl
03-23 10:16:10.591 19412-19412/com.geoida.progeo W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
03-23 10:16:10.823 19412-19412/com.geoida.progeo I/HwCust: Constructor found for class android.widget.HwCustTextViewImpl
03-23 10:16:10.951 19412-19412/com.geoida.progeo I/HwCust: Constructor found for class android.widget.HwCustTextViewImpl
03-23 10:16:10.979 19412-19412/com.geoida.progeo I/HwSecImmHelper: mSecurityInputMethodService is null
03-23 10:16:11.048 19412-20179/com.geoida.progeo E/HAL: load: id=gralloc != hmi->id=gralloc
03-23 10:16:11.049 19412-20179/com.geoida.progeo I/OpenGLRenderer: Initialized EGL, version 1.4
03-23 10:16:11.242 19412-19412/com.geoida.progeo W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
03-23 10:16:11.252 19412-19412/com.geoida.progeo I/HwSecImmHelper: mSecurityInputMethodService is null
03-23 10:16:11.254 19412-19412/com.geoida.progeo I/HwSecImmHelper: mSecurityInputMethodService is null
03-23 10:16:13.793 19412-19412/com.geoida.progeo I/zzai: Making Creator dynamically
03-23 10:16:13.893 19412-19412/com.geoida.progeo W/System: ClassLoader referenced unknown path: /data/user/0/com.google.android.gms/app_chimera/m/00000019/n/arm64-v8a
03-23 10:16:13.905 19412-19412/com.geoida.progeo I/System.out: [/system/bin/getprop, debug.mapview.logs]
03-23 10:16:13.905 19412-19412/com.geoida.progeo I/System.out: null
03-23 10:16:13.905 19412-19412/com.geoida.progeo I/System.out: null
03-23 10:16:13.905 19412-19412/com.geoida.progeo I/System.out: Calling by::className:com.google.maps.api.android.lib6.common.q MethodName:a
03-23 10:16:14.031 19412-19412/com.geoida.progeo I/Google Maps Android API: Google Play services client version: 10298000
03-23 10:16:14.039 19412-19412/com.geoida.progeo I/Google Maps Android API: Google Play services package version: 10298448
03-23 10:16:14.040 19412-19412/com.geoida.progeo I/System.out: [/system/bin/getprop, debug.mapview.renderer]
03-23 10:16:14.040 19412-19412/com.geoida.progeo I/System.out: null
03-23 10:16:14.040 19412-19412/com.geoida.progeo I/System.out: null
03-23 10:16:14.041 19412-19412/com.geoida.progeo I/System.out: Calling by::className:com.google.maps.api.android.lib6.common.q MethodName:a
03-23 10:16:14.073 19412-19412/com.geoida.progeo I/System.out: [/system/bin/getprop, debug.mapview.streetview]
03-23 10:16:14.073 19412-19412/com.geoida.progeo I/System.out: null
03-23 10:16:14.073 19412-19412/com.geoida.progeo I/System.out: null
03-23 10:16:14.074 19412-19412/com.geoida.progeo I/System.out: Calling by::className:com.google.maps.api.android.lib6.common.q MethodName:a
03-23 10:16:14.140 19412-19412/com.geoida.progeo I/Process: Sending signal. PID: 19412 SIG: 9
Solution
I've found the solution. I find out that google maps api key was stored two times in my AndroidManifest file and that was the problem. Thanks for all answers.
Answered By - KamCho
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.