TensorFlowlite对象检测演示应用活动(Android Studio)将无法启动

时间:2019-12-21 16:10:27

标签: java android tensorflow-lite object-detection-api

仅在单击按钮时才尝试通过启动DetectorActivity(执行检测的主要活动)来调整应用程序。  因此,在源代码中,我添加了一个类“ Main Activity”,将其设置为清单中的启动活动,并在xml中添加了一个按钮,单击该按钮应将意图发送给DetectorActivity并启动它。代码差不多是这样的:

 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    public void on(View v){
        Intent i = new Intent(this,DetectorActivity.class);
        startActivity(i);
    }

但是,该活动从未启动,这非常令人困惑。 这是模拟器的日志:

 I/art: Ignoring second debugger -- accepting and dropping
12-21 20:39:13.111 23543-23550/.abc I/art: Ignoring second debugger -- accepting and dropping
12-21 20:39:13.563 23543-23543/.abc 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
12-21 20:39:13.745 23543-23554/abc I/art: Background sticky concurrent mark sweep GC freed 9521(535KB) AllocSpace objects, 0(0B) LOS objects, 75% free, 950KB/3MB, paused 8.576ms total 187.364ms
12-21 20:39:14.110 23543-23543/abc I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
12-21 20:39:14.112 23543-23543/.abc I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
12-21 20:39:15.082 23543-23577/abc D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-21 20:39:15.338 23543-23577/.abc I/OpenGLRenderer: Initialized EGL, version 1.4
12-21 20:39:15.338 23543-23577/abc W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
12-21 20:39:15.387 23543-23577/abc D/EGL_emulation: eglCreateContext: 0x7f758dd74f40: maj 2 min 0 rcv 2
12-21 20:39:15.403 23543-23577/abc D/EGL_emulation: eglMakeCurrent: 0x7f758dd74f40: ver 2 0 (tinfo 0x7f758dd532a0)
12-21 20:39:15.777 23543-23577/abc D/EGL_emulation: eglMakeCurrent: 0x7f758dd74f40: ver 2 0 (tinfo 0x7f758dd532a0)
12-21 20:39:16.102 23543-23543/abc I/Choreographer: Skipped 56 frames!  The application may be doing too much work on its main thread.
12-21 20:57:47.896 23543-23550/abc I/art: Ignoring second debugger -- accepting and dropping
12-21 20:57:47.909 23543-23550/abc I/art: Ignoring second debugger -- accepting and dropping
12-21 21:00:48.853 23543-23550/abc I/art: Ignoring second debugger -- accepting and dropping

在此问题上的任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

  

您如何设置点击监听器?该日志表明它没有被调用。

@RyanMentley的评论解决了这个问题,非常感谢。