Android 为什么每次我的应用程序崩溃,找不到错误,代码字体大?

Android 为什么每次我的应用程序崩溃,找不到错误,代码字体大?,android,Android,这就是问题所在:我正在编写一个应用程序,需要添加一个导航抽屉。找到了第三方支持库。编写了代码,没有错误,但安装后应用程序崩溃。帮助我尝试了不同的库,但它不起作用。如果有必要,我会提供其他文件 主要活动 build.gradle应用程序 LogCat 这是故障日志中指出问题的一行: 您需要将Theme.AppCompat主题或子代用于此 活动 您需要将活动设置为在清单文件中使用Theme.AppCompat <activity android:name=".MainActivity"

这就是问题所在:我正在编写一个应用程序,需要添加一个导航抽屉。找到了第三方支持库。编写了代码,没有错误,但安装后应用程序崩溃。帮助我尝试了不同的库,但它不起作用。如果有必要,我会提供其他文件

主要活动

build.gradle应用程序

LogCat


这是故障日志中指出问题的一行:

您需要将Theme.AppCompat主题或子代用于此 活动

您需要将活动设置为在清单文件中使用Theme.AppCompat

    <activity android:name=".MainActivity"
        android:theme="@style/Theme.AppCompat">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

你能发布你的清单文件吗?你知道手机的SDK版本吗?这是最大的线索“你需要在这个活动中使用一个Theme.AppCompat主题或后代。”-这个错误涉及到对旧代码/手机的支持。你的“实用性”扩展到了什么?这是否回答了你的问题?我在清单上写下了这个主题,错误并没有消失。为什么是负面评论?
apply plugin: ... 

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

    defaultConfig {
        applicationId ...
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile "com.android.support:support-v4:23.2.+"
    compile "com.android.support:appcompat-v7:27.1.1"
    compile 'com.android.support:design:22.+.+'
    compile 'com.heinrichreimersoftware:material-drawer:2.3.3'
}
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               FATAL EXCEPTION: main
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               Process: net.aaaps.webdesignlearning, PID: 19062
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               java.lang.RuntimeException: Unable to start activity ComponentInfo{net.aaaps.webdesignlearning/net.aaaps.webdesignlearning.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2969)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3047)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.app.ActivityThread.-wrap11(Unknown Source:0)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1777)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.os.Handler.dispatchMessage(Handler.java:106)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.os.Looper.loop(Looper.java:166)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.app.ActivityThread.main(ActivityThread.java:6861)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at java.lang.reflect.Method.invoke(Native Method)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:450)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:113)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at net.aaaps.webdesignlearning.MainActivity.onCreate(MainActivity.java:20)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.app.Activity.performCreate(Activity.java:7110)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.app.Activity.performCreate(Activity.java:7101)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2922)
11-08 01:27:33.717 19062 19062 E   AndroidRuntime                               ... 9 more
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               FATAL EXCEPTION: main
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               Process: net.aaaps.webdesignlearning, PID: 19421
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               java.lang.RuntimeException: Unable to start activity ComponentInfo{net.aaaps.webdesignlearning/net.aaaps.webdesignlearning.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2969)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3047)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.app.ActivityThread.-wrap11(Unknown Source:0)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1777)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.os.Handler.dispatchMessage(Handler.java:106)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.os.Looper.loop(Looper.java:166)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.app.ActivityThread.main(ActivityThread.java:6861)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at java.lang.reflect.Method.invoke(Native Method)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:450)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:113)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at net.aaaps.webdesignlearning.MainActivity.onCreate(MainActivity.java:18)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.app.Activity.performCreate(Activity.java:7110)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.app.Activity.performCreate(Activity.java:7101)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2922)
11-08 01:28:28.301 19421 19421 E   AndroidRuntime                               ... 9 more
11-08 01:29:01.300 19991 19991 E   AndroidRuntime                               FATAL EXCEPTION: main
11-08 01:29:01.300 19991 19991 E   AndroidRuntime                               Process: net.aaaps.webdesignlearning, PID: 19991
11-08 01:29:01.300 19991 19991 E   AndroidRuntime                               java.lang.RuntimeException: Unable to start activity ComponentInfo{net.aaaps.webdesignlearning/net.aaaps.webdesignlearning.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
11-08 01:29:01.300 19991 19991 E   AndroidRuntime                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2969)
11-08 01:29:01.300 19991 19991 E   AndroidRuntime                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3047)
11-08 01:29:01.300 19991 19991 E   AndroidRuntime                               at android.app.ActivityThread.-wrap11(Unknown Source:0)
    <activity android:name=".MainActivity"
        android:theme="@style/Theme.AppCompat">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>