猿问

“不幸的是,应用程序已停止” java.lang.RuntimeException:

所以,我一直在 YouTube 上为我们的应用程序学习本教程,因为我对应用程序开发几乎一无所知(自学),所以我手动输入了它,所以我可以知道哪些行有这些代码......我只是不知道当我按照视频中的所有内容(或者我可能错过了某些内容)时,有什么问题。我的应用程序无法运行。


`08-27 16:50:41.336 4192-4192/e.alasse.opencv E/MultiWindowProxy: getServiceInstance failed!

08-27 16:50:41.818 4192-4192/e.alasse.opencv E/AndroidRuntime: FATAL EXCEPTION: main

Process: e.alasse.opencv, PID: 4192

java.lang.RuntimeException: Unable to start activity ComponentInfo{e.alasse.opencv/e.alasse.opencv.OpenCamera}: android.view.InflateException: Binary XML file line #20: Binary XML file line #20: Error inflating class ImageView

    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2572)

    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)

    at android.app.ActivityThread.-wrap11(ActivityThread.java)

    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)

    at android.os.Handler.dispatchMessage(Handler.java:111)

    at android.os.Looper.loop(Looper.java:207)

    at android.app.ActivityThread.main(ActivityThread.java:5728)

    at java.lang.reflect.Method.invoke(Native Method)

    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)

    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)

 Caused by: android.view.InflateException: Binary XML file line #20: Binary XML file line #20: Error inflating class ImageView

    at android.view.LayoutInflater.inflate(LayoutInflater.java:539)

    at android.view.LayoutInflater.inflate(LayoutInflater.java:423)

    at android.view.LayoutInflater.inflate(LayoutInflater.java:374)

    at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)

    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)

    at e.alasse.opencv.OpenCamera.onCreate(OpenCamera.java:33)

    at android.app.Activity.performCreate(Activity.java:6301)


汪汪一只猫
浏览 202回答 1
1回答

蝴蝶刀刀

尝试替换以下属性app:srcCompat="@drawable/ic_launcher_foreground" />在你的activity_open_camera.xml文件在“ImageView”元素的底部android:src="@drawable/ic_launcher_foreground"/>让我知道它是否有助于避免应用程序的 ANR 状态。
随时随地看视频慕课网APP

相关分类

Java
我要回答