有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

SplashScreen中的java 安卓异常

    package com.example.activity;

    import 安卓.content.Intent;
    import 安卓.os.Bundle;
    import 安卓.os.Handler;
    import 安卓.support.v7.app.AppCompatActivity;

    import com.example.NewActivity.PhoneNumberRegistration;
    import com.example.aayushchaubey.meetdax.R;

    public class SplashScreenActivity extends AppCompatActivity {
        private static int SPLASH_TIME_OUT = 3000;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_splash);

            new Handler().postDelayed(new Runnable() {

                /*
                 * Showing splash screen with a timer. This will be useful when you
                 * want to show case your app logo / company
                 */

                @Override
                public void run() {
                    // This method will be executed once the timer is over
                    // Start your app main activity
    //                ProgressDialog progressDialog = new ProgressDialog(SplashScreenActivity.this);
    //                progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    //                progressDialog.setMessage("Please wait");
    //                progressDialog.setCancelable(false);
    //                progressDialog.show();
                    Intent i = new Intent(SplashScreenActivity.this, PhoneNumberRegistration.class);
                    startActivity(i);

                    // close this activity
                    finish();
                }
            }, SPLASH_TIME_OUT);
        }
    }

错误是:-

art/runtime/runtime.cc:422]   native: #55 pc 000000000026770c  /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+184)
       art/runtime/runtime.cc:422]   native: #56 pc 0000000000288634  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+564)
       art/runtime/runtime.cc:422]   native: #57 pc 00000000002b80a0  /system/lib64/libart.so (_ZN3art11interpreterL8DoInvokeILNS_10InvokeTypeE2ELb0ELb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+612)
       art/runtime/runtime.cc:422]   native: #58 pc 00000000002abd78  /system/lib64/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+17508)
       art/runtime/runtime.cc:422]   native: #59 pc 0000000000261a14  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+484)
       art/runtime/runtime.cc:422]   native: #60 pc 000000000054bee8  /system/lib64/libart.so (artQuickToInterpreterBridge+812)
       art/runtime/runtime.cc:422]   native: #61 pc 00000000000dc1ac  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
       art/runtime/runtime.cc:422]   native: #62 pc 00000000008f8618  /system/framework/arm64/boot-framework.oat (???)
       art/runtime/runtime.cc:422]   at com.example.activity.SplashScreenActivity.onCreate(SplashScreenActivity.java:16)
       art/runtime/runtime.cc:422]   at 安卓.app.Activity.performCreate(Activity.java:6992)
       art/runtime/runtime.cc:422]   at 安卓.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
       art/runtime/runtime.cc:422]   at 安卓.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)

当Splashscreen打开时,它的应用程序正在崩溃。在这一行中,它在logcat(newhandler()中显示错误,但不显示错误消息。postDelayed(新的Runnable()。这是应用程序崩溃后显示的日志


共 (1) 个答案

  1. # 1 楼答案

    代码看起来不错,导入R文件时可能有问题

    删除

    import com.example.NewActivity.PhoneNumberRegistration;
    import com.example.aayushchaubey.meetdax.R;
    

    使用Alt+Enter导入类再次导入类文件

    SplashScreenActivityPhoneNumberRegistration注册到清单文件

    清理并重建,再次运行它,它可能会解决您的问题