我的安卓应用在设备上无法运行

3
我的安卓应用一开始运行得很好。后来我添加了一个字体族到样式中,同时改变了API级别。但是它没有起作用。
所以我从样式中删除了字体族,尝试降低API级别,但出了问题,现在应用程序可以安装,但无法运行。 我试图在这里找到类似的问题,但没有成功,也许我把应用程序搞得更糟了:(
我很年轻,两个月前才开始编码,请给我发送详细说明以解决问题。
我的设备API - 15
这是我的build.gradle-
 apply plugin: 'com.android.application'

    android {
        compileSdkVersion 26
        buildToolsVersion "26.0.0"
        defaultConfig {
            applicationId "com.example.ondra.dejepisno_zemepisnymilionar"
            minSdkVersion 15
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:26.+'
        compile 'com.android.support.constraint:constraint-layout:1.0.2'
        compile 'com.android.support:design:26.+'
        compile 'com.google.android.gms:play-services-vision:9.4.0+'
        testCompile 'junit:junit:4.12'
    }

Android清单文件 -

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

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

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

        </application>

    </manifest>

我的 styles.xml -

 <resources>

        <!-- Base application theme. -->
        <style

            name="AppTheme"
            parent="android:Theme.Light.NoTitleBar">

            <!-- Customize your theme here. -->
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>
            <item name="android:textViewStyle">@style/TextViewStyle</item>
            <item name="android:buttonStyle">@style/ButtonStyle</item>
        </style>


        <style name="TextViewStyle" parent="android:Widget.TextView">

        </style>


        <style name="ButtonStyle" parent="android:Widget.Button">

        </style>


    </resources>

我会非常感谢任何能帮助我的答案,因为我已经花了大约20个小时来寻找解决方案或尝试修复应用程序,但不幸的是似乎没有什么作用 :/ 更新 - 日志 - 我的日志 更新2 我在主活动中使用更多布局,但这是On Create方法中的第一个布局。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.ondra.dejepisno_zemepisnymilionar.MainActivity"
    android:background="@drawable/menu2">


    <Button
        android:id="@+id/novahra"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="NOVÁ HRA"
        android:layout_marginTop="131dp"
        android:layout_alignParentTop="true"
        android:layout_alignLeft="@+id/ovyvojari"
        android:layout_alignRight="@+id/ovyvojari" />

    <Button
        android:id="@+id/ovyvojari"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="O VÝVOJÁŘI"
        android:layout_marginTop="31dp"
        android:layout_below="@+id/bhighscore"
        android:layout_alignLeft="@+id/specialnipodekovani"
        android:layout_alignRight="@+id/specialnipodekovani" />

    <Button
        android:id="@+id/specialnipodekovani"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="22dp"
        android:text="SPECIÁLNÍ PODĚKOVÁNÍ"
        android:layout_below="@+id/ovyvojari"
        android:layout_centerHorizontal="true" />

    <Button
        android:id="@+id/bhighscore"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="27dp"
        android:text="HIGH SCORE"
        android:layout_below="@+id/novahra"
        android:layout_alignLeft="@+id/novahra"
        android:layout_alignStart="@+id/novahra"
        android:layout_alignRight="@+id/ovyvojari"
        android:layout_alignEnd="@+id/ovyvojari" />

</RelativeLayout>

1
你能展示一下日志吗? - phatnhse
我更新了问题 - 最后有一张日志的截图。 - Ondřej Šerek
你能否请发布MainActivity的布局? - Eselfar
我又更新了它 :-) - Ondřej Šerek
1个回答

1

Replace

        name="AppTheme"
        parent="android:Theme.Light.NoTitleBar"> 

with

        name="AppTheme"
        parent="Theme.AppCompat.Light.NoActionBar"> 

in your styles.xml. The error says you need to use AppCompat theme.


非常感谢您! - Ondřej Šerek
你非常受欢迎 :) 你介意点个赞吗? :) - wick.ed

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接