第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

在模擬器中打開時(shí) Android 代碼崩潰

在模擬器中打開時(shí) Android 代碼崩潰

郎朗坤 2023-04-19 16:00:11
我是 java 的新手,但出于某種原因,嘗試創(chuàng)建一個(gè)應(yīng)用程序,該應(yīng)用程序在 android studio 中正確構(gòu)建,但是,當(dāng)嘗試在模擬器中打開時(shí),它崩潰了。 這是我的完整代碼是應(yīng)用程序的壓縮包,我猜,主要錯(cuò)誤是final View rootView = inflater.inflate(R.layout.fragment_sun, container, false);日志:錯(cuò)誤2019-07-25 10:42:48.002 5383-5383/com.example.phocast E/AndroidRuntime: FATAL EXCEPTION: main    Process: com.example.phocast, PID: 5383    android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.v7.widget.RecyclerView    Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.v7.widget.RecyclerView    Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.RecyclerView" on path: DexPathList[[zip file "/data/app/com.example.phocast-j1KYRRVBUGO2ddQzmNBB8w==/base.apk", zip file "/data/app/com.example.phocast-j1KYRRVBUGO2ddQzmNBB8w==/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.phocast-j1KYRRVBUGO2ddQzmNBB8w==/split_lib_resources_apk.apk", zip file "/data/app/com.example.phocast-j1KYRRVBUGO2ddQzmNBB8w==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.phocast-j1KYRRVBUGO2ddQzmNBB8w==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.phocast-j1KYRRVBUGO2ddQzmNBB8w==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.phocast-j1KYRRVBUGO2ddQzmNBB8w==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.phocast-j1KYRRVBUGO2ddQzmNBB8w==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.phocast-j1KYRRVBUGO2ddQzmNBB8w==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.phocast-在代碼的第 69 行SunFragment.java。我不明白 XML 中出了什么問題。對(duì)應(yīng)的 XML 為:    <?xml version="1.0" encoding="utf-8"?>    <android.support.v7.widget.RecyclerView        android:id="@+id/rv_recycler_view"        android:scrollbars="vertical"        android:layout_width="match_parent"        android:layout_height="match_parent"        xmlns:android="http://schemas.android.com/apk/res/android" />有人可以檢查嗎?
查看完整描述

3 回答

?
UYOU

TA貢獻(xiàn)1878條經(jīng)驗(yàn) 獲得超4個(gè)贊

使用

androidx.recyclerview.widget.RecyclerView

fragment_sun.xml而不是

android.support.v7.widget.RecyclerView

因?yàn)樵?strong>build.gradle中依賴是androidx.recyclerview:recyclerview:1.0.0但是在SunFragmentRecyclerView 中是從導(dǎo)入的androidx


查看完整回答
反對(duì) 回復(fù) 2023-04-19
?
四季花海

TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超5個(gè)贊

您正在使用androidx支持庫,因此請(qǐng)使用androidx.recyclerview.widget.RecyclerView


<androidx.recyclerview.widget.RecyclerView
????android:id="@+id/rv_recycler_view"
????android:scrollbars="vertical"
????android:layout_width="match_parent"
????android:layout_height="match_parent"
????xmlns:android="http://schemas.android.com/apk/res/android"?/>



查看完整回答
反對(duì) 回復(fù) 2023-04-19
?
慕蓋茨4494581

TA貢獻(xiàn)1850條經(jīng)驗(yàn) 獲得超11個(gè)贊

以下屏幕截圖來自您的項(xiàng)目搜索結(jié)果:

http://img2.sycdn.imooc.com/643f9fdd0001aa6909690726.jpg

android.support.v7嘗試用相應(yīng)的androidx包替換所有這些包

例如改變

android.support.v7.widget.RecyclerView

androidx.recyclerview.widget.RecyclerView

這是因?yàn)?/strong>您的源代碼使用的是AndroidsX包,但您的 xml 布局使用android 支持包聲明是錯(cuò)誤的。


查看完整回答
反對(duì) 回復(fù) 2023-04-19
  • 3 回答
  • 0 關(guān)注
  • 242 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)