-->

摇篮插件更新后的应用程序图标没有显示到3.0(Application icon not showin

2019-09-26 14:16发布

我想升级我的Android插件从摇篮2.3.3 3.0.1。 我可以修复之后的所有错误迁移指南 。 我现在的问题是,在Android牛轧糖(24)和Android棉花糖(23)应用程序图标被替换为默认的机器人图标。

你能帮我找到问题的原因。 此前图标显示出,我看不出合乎逻辑的理由,为什么不是现在。

我尝试了所有的建议在这里没有成功。

这里是我的清单文件:

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

下面是项目摇篮文件:

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" }
}
}

Answer 1:

Android系统永远不会显示图标的应用程序,直到你怎么做。

使用工具:更换=“ATTR”像你这样在这里- > tools:replace="android:icon,..."将取代较高优先级清单中的图标,并保持图标在较低的优先级清单。



Answer 2:

我也浪费在这个约2小时。 蛮力解决方案是创建一个独立的项目,并在复制我的资产。 从那里,我看到了解决方案:

Android的工作室现在默认MIPMAP-anydpi-V26。 以前我只有纹理贴图,anydpi,其更新到的Gradle 3.0+之前的工作。

希望这可以帮助。



Answer 3:

我发现这个问题在这个Twitter发布 。 “Android插件3.0.0默认启用AAPT2”作为中说明迁移导向 。 看起来,这种变化会导致资源问题。

要解决应用程序的图标我不得不通过增加禁止使用Aapt2的android.enableAapt2=falsegradle.properties文件。

注:当我创建具有相同设置的gradle新的应用程序我无法重现该问题。



文章来源: Application icon not showing after Gradle plugin update to 3.0