2017-12-18 18 views
1

Androidプラグインを2.3.3から3.0.1にアップグレードしたいと考えています。 Migration Guideに続くすべてのエラーを修正できました。私の問題は、Android Nougat(24)とAndroid Marshmallow(23)のアプリケーションアイコンがデフォルトのロボットアイコンに置き換えられたことです。3.0へのGradleプラグインアップデート後にアプリケーションアイコンが表示されない

問題の原因がわかりましたか。以前はアイコンが表示されていましたが、私は今なぜ論理的理由がないのか分かりません。

私はすべての提案を試みましたhere成功なし。ここで

は私のマニフェストファイルです。ここで

<!-- 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ファイルです:

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

この値に対してリソースとして利用可能なものを確認しましたか 'ic_launcher_round' –

+0

あなたの問題なくAndroidスタジオを更新しました。あなたのプロジェクトをきれいにする必要があります。 – salman

+0

@AbdulWaheed私はアイコンをチェックし、彼らは期待どおり私のアプリのアイコンです。 –

答えて

1

Androidシステムは、まで、アプリケーションのアイコンを表示しないでしょうあなたがやる。

tools:replace="attr"と同じように - >tools:replace="android:icon,..."優先度の高いマニフェストのアイコンを置き換えて、優先度の低いマニフェストにアイコンを置きます。

+0

マニフェストマージ中の競合を解決するには、「置換」が必要です。ここに問題が説明されています:https://stackoverflow.com/questions/24506800/android-studio-gradle-icon-error-manifest-merger –

+0

@MarioKutlevもしサブプロジェクトに同じ名前のサブリソースがあるとしたらic_launcher)を使用して、その問題が発生します。 ランダムな解決策は、ランチャーアイコンの名前を変更することです。 – Ibrahim

+0

私はic_launcherの名前を変更しようとしましたが、助けにはなりませんでした。 :( –

0

この問題は、Twitter postにあります。 Migration guideで説明されているように、「Androidプラグイン3.0.0ではデフォルトでAAPT2が有効になります。この変更がリソースに問題を引き起こすように見えます。

アプリケーションのアイコンを修正するには、ファイルにandroid.enableAapt2=falseを追加して、Aapt2の使用を無効にする必要がありました。

注:同じ階調設定の新しいアプリケーションを作成したときに問題を再現できませんでした。

関連する問題