简体   繁体   English

Android App使用AppCompatActivity API16崩溃

[英]Android App Crashes using AppCompatActivity API16

I'm developing a simple android app with a webview that extends AppCompatActivity. 我正在开发一个简单的Android应用程序,其中包含扩展AppCompatActivity的webview。 This is my app manifest 这是我的应用清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package.appname">

<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
    android:name=".App"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity" android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

minSdkVersion:16 targetSdkVersion:24 'com.android.support:appcompat-v7:24.0.0' minSdkVersion:16 targetSdkVersion:24'com.android.support:appcompat-v7:24.0.0'

The problem is when I test the app on my physical devices it runs with no errors on API18 and above. 问题是,当我在我的物理设备上测试应用程序时,它在API18及更高版本上运行时没有错误。 But when I try it on API16 the app crashes 但是当我在API16上试用它时,应用程序崩溃了

E/VdcInflateDelegate: Exception while inflating <vector>
                     android.content.res.Resources$NotFoundException: Resource is not a ColorStateList

E/AndroidRuntime: FATAL EXCEPTION: main
                 java.lang.RuntimeException: Unable to start activity ComponentInfo

and if I change from AppCompatActivity to Activity the app runs fine on API16. 如果我从AppCompatActivity更改为Activity,那么应用程序在API16上运行正常。 I have already tryed many solutions I found online, but none of them worked. 我已经尝试了很多我在网上找到的解决方案,但都没有。 Thanks in advance 提前致谢

更新构建工具后解决

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM