Gradle插件更新到3.0后,应用程序图标未显示 [英] Application icon not showing after Gradle plugin update to 3.0

查看:67
本文介绍了Gradle插件更新到3.0后,应用程序图标未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的Android Gradle插件从2.3.3升级到3.0.1.我可以按照

I want to upgrade my Android Plugin for Gradle from 2.3.3 to 3.0.1. I could fix all the errors following the Migration Guide. My problem now is that on Android Nougat (24) and Android Marshmallow (23) application icon is replaced with the default robot icon.

您能帮我找到问题的原因吗?以前显示了图标,但我不明白为什么现在不显示.

Could you help me find the reason for the problem. Previously icon was shown and I don't see logical reason why not now.

我在此处尝试了所有建议,但没有成功.

I tried all suggestions here without success.

这是我的清单文件:

<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
...

<application
    android:name="...Application"
    android:allowBackup="false"
    android:allowTaskReparenting="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/application"
    android:largeHeap="true"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:theme="@style/Theme.MyTheme"
    tools:replace="android:icon,theme,label,allowBackup">

<uses-library android:name="com.google.android.maps" />

    <activity
        android:name="...SplashActivity"
        android:label="@string/application"
        android:theme="@style/Theme.Splash">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

    </activity>

...


</application>

这是项目Gradle文件:

Here is project Gradle file:

buildscript {
ext.kotlinVersion = '1.2.10'
repositories {
    jcenter()
    google()
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.google.gms:google-services:3.1.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}

allprojects {
ext {
    androidApplicationId = 'myapp.android'
    androidVersionCode = 1
    androidVersionName = "1.0"
    testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
}

repositories {
    maven { url "https://maven.google.com" }
}
}

推荐答案

我在此上也浪费了大约2个小时.暴力解决方案是创建一个独立项目并复制我的资产.从那里,我找到了解决方案:

I also wasted about 2 hours on this. The brute force solution was to create a stand-alone project and copy my assets over. From there, I spotted the solution:

Android Studio现在默认为 mipmap-anydpi-v26 .以前,我只有 mipmap-anydpi ,可以在将gradle更新为3.0+之前工作.

Android Studio now defaults to mipmap-anydpi-v26. Previous I had mipmap-anydpi only, which worked prior to updated the gradle to 3.0+.

希望这会有所帮助.

这篇关于Gradle插件更新到3.0后,应用程序图标未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆