0

I found that application crashes without logcat entries due to some Native crash. As in Android Studio 2.3.3 the logcat has both Verbose and No filters options are set by default:Logcat Well what are the ways of solving native crashes or identify these crashes?

My application is crashing on opening MapsActivity more than two times i.e on third(edit : now fourth) click to open brings it to crash.

Here is my MapsActivity it receives Location List from the MainActivity and adds markers to the Map on those locations.

import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.location.Location;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.UiSettings;
import com.google.android.gms.maps.model.BitmapDescriptor;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

private GoogleMap mMap;
ArrayList<Location> locs = new ArrayList<>();

@Override
protected void onCreate(Bundle savedInstanceState) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);

    Bundle bundle = getIntent().getExtras();
    String jsonString = bundle.getString("KEY_LOCATIONS");

    Gson gson = new Gson();
    Type listOfLocationType = new TypeToken<List<Location>>() {
    }.getType();
    locs = gson.fromJson(jsonString, listOfLocationType);
}

@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    setUpMap();
}

public void setUpMap() {

    mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
    if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
       return;}
    mMap.setMyLocationEnabled(true);
    mMap.getUiSettings().setMyLocationButtonEnabled(true);
    mMap.getUiSettings().setCompassEnabled(true);

    addMarkeratLocation();
}

public void addMarkeratLocation() {
    int i;
    double lt=0.0,lg=0.0;
    BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.mipmap.dottt);
    LatLng addpoint = new LatLng(0.0, 0.0);
    for (i = 0; i < locs.size(); i++) {
        lt=locs.get(i).getLatitude();
        lg=locs.get(i).getLongitude();
        addpoint = new LatLng(lt,lg );
        mMap.addMarker(new MarkerOptions().position(addpoint).icon(icon));

    }
    mMap.moveCamera(CameraUpdateFactory.newLatLng(addpoint));
    LatLng camloc= new LatLng(lt,lg);
    mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(camloc, 15));

}
}



And this is from where in MainActivity the MapsActivity is being fired.

direction.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(getBaseContext(), "Showing directions", Toast.LENGTH_LONG).show();
            TinyDB tinydb = new TinyDB(MainActivity.this);
            olati=tinydb.getDouble("destination_lati",lati);
            olongi=tinydb.getDouble("destination_longi",longi);

            Gson gson = new Gson();
            String jsonString = gson.toJson(locs);
            Intent intent = new Intent(MainActivity.this,MapsActivity.class);
            intent.putExtra("KEY_LOCATIONS",jsonString);
            startActivity(intent);
        }
    });

I don't know what of Logcat shall I post. How do I sort it out? Thanks in advance.

EDIT : Added Error Logcat
This is something around where the application crashes

12-06 00:12:06.190 18296-18307/com.example.acer.mylocationmap A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x40 in tid 18307 (FinalizerDaemon) 12-06 00:12:07.800 3624-3624/? E/audit: type=1701 msg=audit(1512499327.795:2175): auid=4294967295 uid=10495 gid=10495 ses=4294967295 subj=u:r:untrusted_app:s0 pid=18307 comm="FinalizerDaemon" reason="memory violation" sig=11 12-06 00:12:07.845 2845-20348/? E/android.os.Debug: ro.product_ship = true 12-06 00:12:07.845 2845-20348/? E/android.os.Debug: ro.debug_level = 0x4f4c 12-06 00:12:07.930 2845-2925/? E/InputDispatcher: channel ~ Channel is unrecoverably broken and will be disposed! 12-06 00:12:07.930 2845-2925/? E/InputDispatcher: channel ~ Channel is unrecoverably broken and will be disposed! 12-06 00:12:07.990 20349-20349/? E/Zygote: MountEmulatedStorage() 12-06 00:12:07.990 20349-20349/? E/Zygote: v2 12-06 00:12:07.995 20349-20349/? E/Zygote: accessInfo : 0 12-06 00:12:07.995 20349-20349/? E/SELinux: [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL 12-06 00:12:15.020 2845-2889/? E/ViewRootImpl: sendUserActionEvent() mView == null

Diksha
  • 406
  • 5
  • 20
  • select your app and your device in filter then rerun it. – Ninja Dec 05 '17 at 18:18
  • Have you tried changing from "Verbose" to "Error"?. – BluRe.CN Dec 05 '17 at 18:18
  • @Ninja Got this as the last line in logcat for first crash `A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xd457b008 in tid 8634 (GLThread 31225)` – Diksha Dec 05 '17 at 18:29
  • @BluRe.CN tried but not able to understand anything in it... Shall I post the "Error" logcat? – Diksha Dec 05 '17 at 18:34
  • yes, share your error log. Other think is it might happen if something wrong with your GL. I don't think so that is happen with google map. where you test your project(Emulator or Device)? – Ninja Dec 05 '17 at 18:34
  • @Ninja I'm testing the project on device – Diksha Dec 05 '17 at 18:48

1 Answers1

0

Check your build variant has debug set to true in the build.gradle file

This is commonly set to false on release versions of applications as it is a requirement for publishing to the play store .

  • build.gradle file of Application or Module? Is this what you saying? `buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }` – Diksha Dec 06 '17 at 05:50
  • Your Module build.gradle file. I also see you are using android studio. Android studio has a built in debugger, so you can put break points (click next to line number in file and a red blob should appear) by suspicious code, and step through as necessary, this should help pin point exactly where it is breaking. [debugging in android studio](https://developer.android.com/studio/debug/index.html) –  Dec 06 '17 at 19:26