亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

條碼掃描器 zxing 在啟動時崩潰

條碼掃描器 zxing 在啟動時崩潰

子衿沉夜 2022-10-12 10:20:10
應用程序在啟動時崩潰。試圖只從官方中提取一段代碼:zxing-sample所以我的 activity_main.xml 代碼來自示例,例如<?xml version="1.0" encoding="utf-8"?><LinearLayout    xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    android:orientation="vertical"    android:layout_width="fill_parent"    android:layout_height="fill_parent">    <android.support.design.widget.AppBarLayout        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"        android:layout_width="match_parent"        android:layout_height="wrap_content">        <android.support.v7.widget.Toolbar            android:id="@+id/toolbar"            android:layout_width="match_parent"            android:layout_height="wrap_content"/>    </android.support.design.widget.AppBarLayout>    <LinearLayout        android:orientation="vertical"        android:layout_width="match_parent"        android:layout_height="match_parent">        <FrameLayout            android:id="@+id/content_frame"            android:layout_weight="1"            android:layout_width="match_parent"            android:layout_height="match_parent" />        <LinearLayout            android:orientation="horizontal"            android:gravity="center"            android:background="#222"            android:layout_width="match_parent"            android:layout_height="150dp">            <Button                android:text="Koristiti kameru"                android:layout_weight="1"                android:onClick="toggleFlash"                android:layout_width="wrap_content"                android:layout_height="wrap_content"/>        </LinearLayout>    </LinearLayout></LinearLayout>
查看完整描述

2 回答

?
當年話下

TA貢獻1890條經驗 獲得超9個贊

在您的應用程序 Gradle 文件中,檢查implementation 'com.android.support:design:28.0.0'您的dependencies



查看完整回答
反對 回復 2022-10-12
?
狐的傳說

TA貢獻1804條經驗 獲得超3個贊

查看您的 Logcat,它顯示了問題所在。


    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/com.example.myapplication.MainActivity}: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class android.support.design.widget.AppBarLayout

     ...

     Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.AppBarLayout" on path: DexPathList[[zip file "/data/app/com.example.myapplication-y9OZiywnTa-bCM9Op2luAw==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.myapplication-y9OZiywnTa-bCM9Op2luAw==/lib/arm, /system/lib, /vendor/lib]]


所以,這意味著它無法啟動您的活動MainAcitivty,因為它找不到類AppBarLayout。您可能缺少依賴項。


查看完整回答
反對 回復 2022-10-12
  • 2 回答
  • 0 關注
  • 150 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號