Подтвердить что ты не робот

Android Oreo - как установить Adaptive Icons в Кордове?

Просто интересно, удалось ли настроить адаптивные значки на Кордове для Android Oreo? Я использую android 6.4.0, и моя квадратная иконка сжимается, чтобы соответствовать кругу. Я просто хочу, чтобы он не сокращался. Меня не волнует, если углы обрезаны от округления.

4b9b3361

Ответ 1

Я создал значки, как описано в https://developer.android.com/studio/write/image-asset-studio.html#create-adaptive, скопировал их для res/android и использовал следующую конфигурацию:

config.xml:

<widget ... xmlns:android="http://schemas.android.com/apk/res/android">
    <platform name="android">
        <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
            <application android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" />
        </edit-config>
        <resource-file src="res/android/drawable/ic_launcher_background.xml" target="app/src/main/res/drawable/ic_launcher_background.xml" />
        <resource-file src="res/android/drawable/ic_launcher_foreground.xml" target="app/src/main/res/drawable/ic_launcher_foreground.xml" />
        <resource-file src="res/android/mipmap-anydpi-v26/ic_launcher.xml" target="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" />
        <resource-file src="res/android/mipmap-anydpi-v26/ic_launcher_round.xml" target="app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" />
        <resource-file src="res/android/mipmap-hdpi/ic_launcher.png" target="app/src/main/res/mipmap-hdpi/ic_launcher.png" />
        <resource-file src="res/android/mipmap-hdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-hdpi/ic_launcher_round.png" />
        <resource-file src="res/android/mipmap-mdpi/ic_launcher.png" target="app/src/main/res/mipmap-mdpi/ic_launcher.png" />
        <resource-file src="res/android/mipmap-mdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-mdpi/ic_launcher_round.png" />
        <resource-file src="res/android/mipmap-xhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher.png" />
        <resource-file src="res/android/mipmap-xhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher_round.png" />
        <resource-file src="res/android/mipmap-xxhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher.png" />
        <resource-file src="res/android/mipmap-xxhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png" />
        <resource-file src="res/android/mipmap-xxxhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher.png" />
        <resource-file src="res/android/mipmap-xxxhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png" />
    </platform>    
</widget>

Ответ 2

Поэтому, хотя приведенные выше ответы помогли мне получить ответ, они либо устарели, либо неполны. Поэтому, чтобы помочь кому-либо двигаться вперед, это полный ответ со всеми возможными моментами, которые я мог придумать.

Шаг 1. Создание значков

Вы захотите сделать это, используя Image Asset Studio (https://developer.android.com/studio/write/image-asset-studio). Там есть несколько руководств по этому поводу.

Шаг 2. Переместите значки в ваш проект ionic/cordova

Скопируйте всю папку res в свой проект. Ниже приведен пример ионного v1.

cp -a AndroidStudioProjects/MyApplication4/app/src/main/res MyIonicProject/myapp/resources/android/adaptiveicon

Шаг 3: отредактируйте файл config.xml

Во-первых, чтобы использовать значки (этого нет в других ответах), вам нужно изменить верхнюю строку widget. Вам нужно добавить xmlns:android="schemas.android.com/apk/res/android", чтобы он выглядел следующим образом. Это позволяет системе изменять файл AndroidMenifest.xml.

<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:android="schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">

Затем вам нужно настроить раздел платформы вашего config.xml.

Сначала удалите все экземпляры <icon density=.../> из раздела <platform name="android">.

Затем добавьте в файл Android Manifest:

<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
    <application android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" />
</edit-config>

И, наконец, для каждого файла в новой папке resources/android/adaptiveicon вам нужно добавить строку следующим образом:

<resource-file src="resources/android/adaptiveicon/<folder>/<file>" target="app/src/main/res/<folder>/<file>" />

Убедитесь, что все файлы представлены! Ваша финальная часть platform, вероятно, будет выглядеть так (в этом примере используется PNG для фона и фона):

<platform name="android">
    <allow-intent href="market:*" />
    <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
    <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
    <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
    <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
    <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
    <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
    <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
    <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
    <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
    <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
    <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
    <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
        <application android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" />
    </edit-config>
    <resource-file src="resources/android/adaptiveicon/drawable/ic_launcher_background.xml" target="app/src/main/res/drawable/ic_launcher_background.xml" />
    <resource-file src="resources/android/adaptiveicon/drawable-v24/ic_launcher_foreground.xml" target="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" />
    <resource-file src="resources/android/adaptiveicon/mipmap-anydpi-v26/ic_launcher.xml" target="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" />
    <resource-file src="resources/android/adaptiveicon/mipmap-anydpi-v26/ic_launcher_round.xml" target="app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" />
    <resource-file src="resources/android/adaptiveicon/mipmap-hdpi/ic_launcher.png" target="app/src/main/res/mipmap-hdpi/ic_launcher.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-hdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-hdpi/ic_launcher_background.png" target="app/src/main/res/mipmap-hdpi/ic_launcher_background.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-hdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-hdpi/ic_launcher_round.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-mdpi/ic_launcher.png" target="app/src/main/res/mipmap-mdpi/ic_launcher.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-mdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-mdpi/ic_launcher_background.png" target="app/src/main/res/mipmap-mdpi/ic_launcher_background.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-mdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-mdpi/ic_launcher_round.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-xhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-xhdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-xhdpi/ic_launcher_background.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher_background.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-xhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher_round.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-xxhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-xxhdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-xxhdpi/ic_launcher_background.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-xxhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-xxxhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-xxxhdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-xxxhdpi/ic_launcher_background.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png" />
    <resource-file src="resources/android/adaptiveicon/mipmap-xxxhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png" />
</platform>

Шаг 4: Играйте в нее безопасно, очистите платформу Android

Для очистки платформы выполните следующие команды.

cd myapp
rm -rf platforms/android
ionic cordova prepare

Для хорошей меры исправьте ошибки с запуском эмулятора Android в ионном режиме:

wget https://raw.githubusercontent.com/gegenokitaro/cordova-android/8d497784ac4a40a9689e616cd486c4ed07d3e063/bin/templates/cordova/lib/emulator.js -O platforms/android/cordova/lib/emulator.js

Шаг 5: Постройте!

Телосложение:

ionic cordova build android

Или Эмулировать:

ionic cordova emulate android --consolelogs --serverlogs --target "Android8"

Ответ 3

Теперь это поддерживается Cordova Android 8.0.0. Смотрите объявление и документацию.

Например, определите значки следующим образом в вашем config.xml:

<platform name="android">
        <resource-file src="res/icons/android/colors.xml" target="/app/src/main/res/values/colors.xml" />
        <icon density="ldpi" background="@color/background" foreground="res/icons/android/ldpi-foreground.png" />
        <icon density="mdpi" background="@color/background" foreground="res/icons/android/mdpi-foreground.png" />
        <icon density="hdpi" background="@color/background" foreground="res/icons/android/hdpi-foreground.png" />
        <icon density="xhdpi" background="@color/background" foreground="res/icons/android/xhdpi-foreground.png" />
        <icon density="xxhdpi" background="@color/background" foreground="res/icons/android/xxhdpi-foreground.png" />
        <icon density="xxxhdpi" background="@color/background" foreground="res/icons/android/xxxhdpi-foreground.png" />
    </platform>

С colors.xml выглядит так:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="background">#FFFFFF</color>
</resources>

Ответ 4

Насколько я знаю, Кордова еще не устанавливает Адаптивные значки. Но достаточно легко сделать это вручную после того, как вы запустили сборку Кордовы.

Изменить андроид: значок в AndroidManifest.xml:

<application android:hardwareAccelerated="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:supportsRtl="true">  

Создайте ic_launcher.xml в res/drawable с помощью:

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/ic_launcher_background"/>
    <foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Затем добавьте два векторных файла ic_launcher_background.xml и ic_launcher_foreground.xml в res/drawable. Они могут быть созданы с помощью этого инструмента: http://inloop.github.io/svg2android/

И уходите! Надеюсь, Кордова скоро выпечет это в своих сборках.

Ответ 5

Итак, вот обновление для Ionic v4 и Cordova Android: 6.4.0. Заметные изменения в ответе 0x6368656174:

  • Удаление app/src/main из целевых ресурсов.
  • Мой background.xml находился в папке values (у меня не было переднего плана, так как я использовал png)
  • Местоположение файла манифеста edit-config находится в том же каталоге file="AndroidManifest.xml"

Я боролся в течение нескольких дней, но это то, что работает для меня:

config.xml

<widget ... xmlns:android="http://schemas.android.com/apk/res/android">
    <platform name="android">
    <resource-file src="resources/android/values/ic_launcher_background.xml" target="res/values/ic_launcher_background.xml" />
    <resource-file src="resources/android/mipmap-anydpi-v26/ic_launcher.xml" target="res/mipmap-anydpi-v26/ic_launcher.xml" />
    <resource-file src="resources/android/mipmap-anydpi-v26/ic_launcher_round.xml" target="res/mipmap-anydpi-v26/ic_launcher_round.xml" />
    <resource-file src="resources/android/mipmap-hdpi/ic_launcher.png" target="res/mipmap-hdpi/ic_launcher.png" />
    <resource-file src="resources/android/mipmap-hdpi/ic_launcher_round.png" target="res/mipmap-hdpi/ic_launcher_round.png" />
    <resource-file src="resources/android/mipmap-mdpi/ic_launcher.png" target="res/mipmap-mdpi/ic_launcher.png" />
    <resource-file src="resources/android/mipmap-mdpi/ic_launcher_round.png" target="res/mipmap-mdpi/ic_launcher_round.png" />
    <resource-file src="resources/android/mipmap-xhdpi/ic_launcher.png" target="res/mipmap-xhdpi/ic_launcher.png" />
    <resource-file src="resources/android/mipmap-xhdpi/ic_launcher_round.png" target="res/mipmap-xhdpi/ic_launcher_round.png" />
    <resource-file src="resources/android/mipmap-xxhdpi/ic_launcher.png" target="res/mipmap-xxhdpi/ic_launcher.png" />
    <resource-file src="resources/android/mipmap-xxhdpi/ic_launcher_round.png" target="res/mipmap-xxhdpi/ic_launcher_round.png" />
    <resource-file src="resources/android/mipmap-xxxhdpi/ic_launcher.png" target="res/mipmap-xxxhdpi/ic_launcher.png" />
    <resource-file src="resources/android/mipmap-xxxhdpi/ic_launcher_round.png" target="res/mipmap-xxxhdpi/ic_launcher_round.png" />
    <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
         <application android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" />
    </edit-config>
    </platform>    
</widget>

фу

Ответ 6

Я могу опоздать на вечеринку, но я изо всех сил пытался заставить это работать, потому что (а) с помощью PhoneGap Build, и (б) делать вещи вручную, не используя Android Studio. Итак, для тех, кто играет дома, все, что мне нужно было сделать, чтобы адаптивные иконки работали:

  1. Внутри <platform name="android"> в моем config.xml я установил:
        <resource-file src="www/pwa/android/icon-bg.png"               target="app/src/main/res/mipmap/ic_bg.png" />
        <resource-file src="www/pwa/android/icon-fg.png"               target="app/src/main/res/mipmap/ic_fg.png" />
        <resource-file src="www/pwa/ic/mipmap-xxxhdpi/ic_launcher.png" target="app/src/main/res/mipmap/ic_launcher.png" />
        <resource-file src="www/pwa/ic/mipmap-xxxhdpi/ic_launcher.png" target="app/src/main/res/mipmap/ic_launcher_round.png" />
        <resource-file src="www/pwa/android/ic_launcher.xml"           target="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" />
        <resource-file src="www/pwa/android/ic_launcher_round.xml"     target="app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" />

        <!-- Per https://forums.adobe.com/thread/2576077 -->
        <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
            <application android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" />
        </edit-config>
  1. Файлы PNG в конфигурации выше говорят сами за себя. Файл XML, на который ссылаются как ic_launcher.xml и ic_launcher_round.xml, идентичны, я только что создал этот файл в исходном местоположении и скопировал его через теги ресурса выше. Это содержимое обоих этих файлов XML, public/pwa/android/ic_launcher.xml src public/pwa/android/ic_launcher.xml и ic_launcher_round.xml:
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@mipmap/ic_bg"/>
    <foreground android:drawable="@mipmap/ic_fg"/>
</adaptive-icon>

Примечание. Я нацеливаюсь на phonegap ver 8.1.1 (<preference name="phonegap-version" value="cli-8.1.1"/>). Сообщение на https://forums.adobe.com/thread/2576077 было полезным. в освещении того факта, что вы должны использовать разные target пути в тегах <resource-file, в зависимости от используемой вами версии cli.

Надеюсь, это поможет, задавайте мне вопросы, если я что-то пропустил. Ура!

Ответ 7

В последних версиях Android используются Adaptive Icons, которые имеют фоновые изображения и изображения на переднем плане вместе с некоторыми XML файлами. Вот что я сделал для настройки адаптивных значков в моем ионном приложении:

  1. В config.xml я установил android-minSdkVersion на версию 26.
<preference name="android-minSdkVersion" value="26" />
<preference name="android-targetSdkVersion" value="28" />
  1. В config.xml удалите теги icon density и удалите следующие строки:
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
  1. Далее мне пришлось создать адаптивные иконки Android. Для этого я использовал Image Assets, который входит в состав Android Studio. Сначала я создал 2 фоновое изображение и изображение только с прозрачным значком для использования в качестве переднего плана в формате png из фотошопа. После этого я выполнил следующие действия для создания значков:

    • Откройте Android Studio и создайте новый проект или откройте существующий проект.

    • Нажмите на приложение → Res на левой боковой панели. Щелкните правой кнопкой мыши на res → New → Image Assets

enter image description here

  • Выбранный слой переднего плана → Тип актива "Изображение" & Выбранная дорожка со значком только логотипом изображения и прозрачным фоном. Затем выберите "Обрезать до Да" и при необходимости изменить размер.

enter image description here

  • Выбранный фоновый слой → Тип актива "Изображение" & выбранный путь. (Альтернативно, вы даже можете установить "Цвет")

enter image description here

  • Нажмите Далее и нажмите "Готово".

enter image description here

  • Теперь я щелкнул правой кнопкой мыши по папке res и выбрал "Показать в Finder".

enter image description here

  • Я скопировал все папки внутри папки res и поместил ее внутрь: my-app/resources/android/adaptiveicon/

enter image description here

  1. Далее мне просто нужно добавить приведенные ниже коды в config.xml. Убедитесь, что каждый файл в папке adaptiveicon связан здесь правильно, иначе он будет выдавать "не найденные" ошибки во время сборки.
        <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
            <application android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" />
        </edit-config>
        <resource-file src="resources/android/adaptiveicon/mipmap-anydpi-v26/ic_launcher.xml" target="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" />
        <resource-file src="resources/android/adaptiveicon/mipmap-anydpi-v26/ic_launcher_round.xml" target="app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" />
        <resource-file src="resources/android/adaptiveicon/mipmap-hdpi/ic_launcher.png" target="app/src/main/res/mipmap-hdpi/ic_launcher.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-hdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-hdpi/ic_launcher_round.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-hdpi/ic_launcher_background.png" target="app/src/main/res/mipmap-hdpi/ic_launcher_background.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-hdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-mdpi/ic_launcher.png" target="app/src/main/res/mipmap-mdpi/ic_launcher.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-mdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-mdpi/ic_launcher_round.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-mdpi/ic_launcher_background.png" target="app/src/main/res/mipmap-mdpi/ic_launcher_background.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-mdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-xhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-xhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher_round.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-xhdpi/ic_launcher_background.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher_background.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-xhdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-xxhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-xxhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-xxhdpi/ic_launcher_background.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-xxhdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-xxxhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-xxxhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-xxxhdpi/ic_launcher_background.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png" />
        <resource-file src="resources/android/adaptiveicon/mipmap-xxxhdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png" />

Это так. Теперь приложение будет иметь адаптивные иконки.

Ответ 8

Я не могу заставить это работать в phonegap cli-8.1.1 Я перепробовал все вышеперечисленное и на https://forums.adobe.com/thread/2576077 Может ли кто-нибудь предоставить работающий общедоступный образец телефонного зазора?

Ответ 9

Сначала вам нужно обновить Кордову до 7.0. Cordova 7.0 поддерживает Android Oreo. После того, как вы создали приложение с помощью Cordova 7, вам придется вручную создавать адаптивные значки с помощью собственного кода Android. Этот средний блог поможет вам в этом. После того, как вы создали свои адаптивные значки, вы можете добавить их в свой файл config.xml следующим образом:

<platform name="android">
    <!--
        ldpi    : 36x36 px
        mdpi    : 48x48 px
        hdpi    : 72x72 px
        xhdpi   : 96x96 px
        xxhdpi  : 144x144 px
        xxxhdpi : 192x192 px
    -->
    <icon src="res/android/ldpi.png" density="ldpi" />
    <icon src="res/android/mdpi.png" density="mdpi" />
    <icon src="res/android/hdpi.png" density="hdpi" />
    <icon src="res/android/xhdpi.png" density="xhdpi" />
    <icon src="res/android/xxhdpi.png" density="xxhdpi" />
    <icon src="res/android/xxxhdpi.png" density="xxxhdpi" />
</platform>