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
它不工作的应用程序不断崩溃每次我尝试运行它它不打开在所有它的行setContentView这是行logcat是引导我当我点击蓝色链接在logcat我已经尝试清理和building它再次也该高速缓存但似乎没有工作
1条答案
按热度按时间44u64gxh1#
请确保您必须更新您的工作室在最新版本。但你可以从下面的几点进行检查。
1.检查日志级别和过滤:确保Logcat工具栏中的日志级别设置为“Error”或“Verbose”,以捕获所有日志消息,包括错误和崩溃。此外,请确保没有应用可能会排除崩溃日志的特定包名称或日志消息筛选器。
1.增加日志缓冲区大小:如果日志缓冲区大小不足,则崩溃日志可能会被截断。单击Logcat工具栏中的齿轮图标,并将“Maximum number of logcat messages to buffer”设置增加到更高的值。这允许保留和显示更多日志消息,包括崩溃日志。
1.开启严格模式:在应用的开发配置中启用严格模式。严格模式有助于检测和报告代码中可能导致崩溃的潜在问题和违规行为。它可以提供常规logcat中可能无法捕获的有关潜在问题的附加日志记录和信息。
1.检查异常处理:确保在代码中有正确的异常处理。未处理的异常可能会导致应用崩溃,而不会生成显式的logcat消息。实现try-catch块或全局异常处理程序来捕获和记录任何未处理的异常。
1.检查ProGuard设置:如果您使用ProGuard进行代码混淆和缩小,请确保正确配置了ProGuard规则。ProGuard可能会混淆与崩溃报告相关的类或方法名称,导致日志信息量较少或缺少重要细节。查看ProGuard规则以保留必要的崩溃报告类或禁用它们的模糊处理。
1.物理设备测试:有时,在模拟器上测试时,与崩溃相关的日志消息可能不会显示在Logcat中。尝试在物理设备上测试您的应用,查看是否正确捕获了崩溃日志。
1.更新Android Studio和SDK工具:确保您使用的是最新版本的Android Studio和SDK工具。过时的版本可能有影响logcat功能的bug或限制。更新到最新的稳定版本,以从错误修复和改进中受益。
也尝试调试一步一步,检查你的崩溃。