Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My android app doesn't work on device

Tags:

java

android

my android app was fine and working. Then I put a font family, into styles, changed the API level. But it wasn't working.

So I deleted the font family from styles, tried to downgrade the API level, but something went wrong and currently the app can be installed, but isn't running.
I tried to find similar problem here, but I wasn't successful and maybe I made the application even worse :(

I'm really young and I started to code only two months ago, so please send me a detail description how to fix the problem.

My device API - 15

Here is my 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 manifest -

<?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>

My 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>

I would be really grateful for any answer, that might help me because I have already spent about 20 hours for searching a solution or trying to fix the app but unfortunately nothing seemed to work :/

UPDATE - Log - My log

UPDATE 2

I use more layouts for my Main Activity, but this is the first layout in On Create method.

<?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>
like image 867
Ondřej Šerek Avatar asked Jun 27 '26 07:06

Ondřej Šerek


1 Answers

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.

like image 200
wick.ed Avatar answered Jun 29 '26 20:06

wick.ed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!