我将布局xml文件放在默认的layout
文件夹中,但是我不知道为什么Android强制使用layout-v21文件夹,因此,我的应用程序崩溃很痛苦。谁能解释一下?
这是日志:
Caused by android.content.res.Resources$NotFoundException: File res/layout-v21/activity_check_internet.xml from xml type layout resource ID #0x7f0b0024
at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1213)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2151)
at android.content.res.Resources.getLayout(Resources.java:1158)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.bplus.activity.BaseActivity.setContentView(BaseActivity.java:121)
at com.bplus.activity.CheckNetworkActivity.onCreate(CheckNetworkActivity.java:94)
at android.app.Activity.performCreate(Activity.java:7258)
at android.app.Activity.performCreate(Activity.java:7249)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1222)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3059)
at android.app.ActivityThread.-wrap11(Unknown Source)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1724)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7000)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
答案 0 :(得分:0)
我认为您可以更改该库的gradle版本,而崩溃不会出现吗,可以将[build.gradle]上的gradle版本更改为最新版本
然后可以将相同的activity_check_internet.xml文件粘贴到布局文件夹中。