0
package com.example.secondar;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.net.Uri;
import android.os.Bundle;


import android.view.View;
import android.widget.Button;

import com.google.ar.core.Anchor;
import com.google.ar.sceneform.AnchorNode;
import com.google.ar.sceneform.rendering.ModelRenderable;
import com.google.ar.sceneform.ux.ArFragment;
import com.google.ar.sceneform.ux.TransformableNode;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {


    private ArFragment arFragment;
    private ArrayList<Integer> imagesPath = new ArrayList<Integer>();
    private ArrayList<String> namesPath = new ArrayList<>();
    private ArrayList<String> modelNames = new ArrayList<>();
    AnchorNode anchorNode;
    private Button btnRemove;

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

        arFragment = (ArFragment)getSupportFragmentManager().findFragmentById(R.id.fragment);
        btnRemove = (Button)findViewById(R.id.remove);
        getImages();

        arFragment.setOnTapArPlaneListener((hitResult, plane, motionEvent) -> {

            Anchor anchor = hitResult.createAnchor();

            ModelRenderable.builder()
                .setSource(this,Uri.parse(Common.model))
                .build()
                .thenAccept(modelRenderable -> addModelToScene(anchor,modelRenderable));

        });

i tried every possible video on youtube aint working it is not working the app keeps crashing every time I try running it it does not open at all its the line setContentView that is the line logcat is directing me to when i click on the blue link in logcat and i have tried cleaning and bulding it again and also invalidating the cache but nothing seems to work

sreelekha
  • 1
  • 1

1 Answers1

0

Make sure you have to update your studio at latest version. but still you can check from below points.

  1. Check log level and filters: Make sure that the log level in the Logcat toolbar is set to "Error" or "Verbose" to capture all log messages, including errors and crashes. Also, ensure that no specific package name or log message filters are applied that might exclude the crash logs.

  2. Increase log buffer size: The crash logs might be getting truncated if the log buffer size is not sufficient. Click on the gear icon in the Logcat toolbar and increase the "Maximum number of logcat messages to buffer" setting to a higher value. This allows more log messages, including crash logs, to be retained and displayed.

  3. Enable strict mode: Enable strict mode in your app's development configuration. Strict mode helps detect and report potential issues and violations in your code that might cause crashes. It can provide additional logging and information about potential problems that may not be captured in the regular logcat.

  4. Check exception handling: Ensure that you have proper exception handling in your code. Unhandled exceptions might cause the app to crash without generating explicit logcat messages. Implement try-catch blocks or global exception handlers to capture and log any unhandled exceptions.

  5. Check ProGuard settings: If you're using ProGuard for code obfuscation and minification, ensure that you have configured the ProGuard rules correctly. ProGuard might obfuscate class or method names related to crash reporting, causing the logs to be less informative or missing important details. Review the ProGuard rules to preserve necessary crash reporting classes or disable obfuscation for them.

  6. Test on a physical device: Sometimes, when testing on an emulator, log messages related to crashes may not be displayed in Logcat. Try testing your app on a physical device to see if the crash logs are captured properly.

  7. Update Android Studio and SDK tools: Ensure that you are using the latest version of Android Studio and SDK tools. Outdated versions might have bugs or limitations that affect logcat functionality. Update to the latest stable release to benefit from bug fixes and improvements.

Also try for debug step by step and check your crash.

Bhavin Solanki
  • 418
  • 2
  • 10