简体   繁体   中英

Why does my app's icon get replaced by the default Android icon when going above minSdkVersion 20?

Ok, this is really odd. In my Gradle file, if I set the minSdkVersion above 20 (which I need to do, because some of the app's features are not supported by anything under 23), my app's icon gets replaced by the Android logo once installed... Everything works fine when minSdkVersion is at 20 or under. Here's my Gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.dev.nihilish.calcplusplus"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 4
        versionName "1.2"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        //android.defaultConfig.vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation files('libs/GraphView-4.2.1.jar')
    compile 'com.squareup.okhttp3:okhttp:3.9.1'
    compile 'com.squareup.okio:okio:1.14.0'
    implementation files('libs/jconvert-1.1.0.jar')
    //compile "com.android.support:support-core-utils:27.1.1"
}

And the manifest:

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

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <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:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar"
            android:resizeableActivity="false">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Graph"
            android:theme="@style/AppTheme.NoActionBar" />
        <activity android:name=".Webviewer" />
        <activity android:name=".SettingsActivity" />
        <activity android:name=".About"></activity>
    </application>

</manifest>

Any idea what might cause this? My icon is set-up properly as ic_launcher in the mipmap folder

Found the culprit. Turns out the v24 version of the icon's drawable was still the default Android icon. Now it works fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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