Android O:找不到API低于Android O的资源

时间:2017-07-06 09:06:07

标签: android android-studio android-imageview android-8.0-oreo

我正在尝试在Android O版本下运行我的应用程序并且应用程序崩溃,并在Android O上正常工作。

崩溃列在下面:

  Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class ImageView
                                                             at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:786)
                                                             at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708)
                                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:839)
                                                             at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
                                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:842)
                                                             at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
                                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:842)
                                                             at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
                                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:519)
                                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
                                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                             at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
                                                             at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                                             at com.chatnow.LoginActivity.onCreate(LoginActivity.java:53) 
                                                             at android.app.Activity.performCreate(Activity.java:6303) 
                                                             at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
                                                             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376) 
                                                             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483) 
                                                             at android.app.ActivityThread.access$900(ActivityThread.java:153) 
                                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349) 
                                                             at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                             at android.os.Looper.loop(Looper.java:148) 
                                                             at android.app.ActivityThread.main(ActivityThread.java:5438) 
                                                             at java.lang.reflect.Method.invoke(Native Method) 
                                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738) 
                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628) 
                                                          Caused by: android.content.res.Resources$NotFoundException: File res/mipmap-anydpi-v21/ic_launcher.xml from drawable resource ID #0x7f0c0000
                                                             at android.content.res.Resources.loadDrawableForCookie(Resources.java:2690)
                                                             at android.content.res.Resources.loadDrawable(Resources.java:2580)
                                                             at android.content.res.MiuiResources.loadDrawable(MiuiResources.java:387)
                                                             at android.content.res.TypedArray.getDrawable(TypedArray.java:872)
                                                             at android.widget.ImageView.<init>(ImageView.java:152)
                                                             at android.widget.ImageView.<init>(ImageView.java:140)
                                                             at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:70)
                                                             at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:66)
                                                             at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
                                                             at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1029)
                                                             at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1087)
                                                             at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:47)
                                                             at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
                                                             at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708) 
                                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:839) 
                                                             at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) 
                                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:842) 
                                                             at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) 
                                                             at android.view.LayoutInflater.rInflate(LayoutInflater.java:842) 
                                                             at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) 
                                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:519) 
                                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
                                                             at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                             at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
                                                             at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                                             at com.chatnow.LoginActivity.onCreate(LoginActivity.java:53) 
                                                             at android.app.Activity.performCreate(Activity.java:6303) 
                                                             at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
                                                             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376) 
                                                             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483) 
                                                             at android.app.ActivityThread.access$900(ActivityThread.java:153) 
                                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349) 
                                                             at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                             at android.os.Looper.loop(Looper.java:148) 
                                                             at android.app.ActivityThread.main(ActivityThread.java:5438) 
                                                             at java.lang.reflect.Method.invoke(Native Method) 
                                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738) 
                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628) 
                                                          Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #2: invalid drawable tag adaptive-icon
                                                             at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1213)
                                                             at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1126)
                                                             at android.content.res.Resources.createFromXml(Resources.java:2964)
                                                            at android.content.res.Resources.loadDrawabl

我创建了一个图像视图并在其中显示了启动器图标。 我已转到New ->Image Asset

创建了启动器图标

图片素材Image Asset 我正在使用Android Studio 3.0 Canary 4

任何帮助都很明显。感谢

  

login.xml

<    ImageView
    android:id="@+id/iv_logo"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:layout_centerHorizontal="true"
    android:src="@mipmap/ic_launcher"   />

0 个答案:

没有答案