Matt
Matt

Reputation: 367

How to setup resource colors for Phonegap

Getting this error on the build:

:app:processDebugResources/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:3: AAPT: error: resource color/ic_launcher_background (aka com.example.app:color/ic_launcher_background) not found. /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:4: AAPT: error: resource mipmap/ic_launcher_foreground (aka com.example.app:mipmap/ic_launcher_foreground) not found.

<platform name="android">
...
<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" />
..
</platform>

Both ic_launcher.xml & ic_launcher_round.xml contents

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

The values (res/android/values) folder contains colors.xml, ic_launcher_background.xml, strings.xml, styles.xml

But is not being recognized.

Upvotes: 0

Views: 1854

Answers (2)

Edwin Veroes
Edwin Veroes

Reputation: 11

You need to add in your config.xml file the following inside the android node

 <platform name="android">
        <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
               <application android:icon="@color/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:color="@mipmap/ic_launcher_background"/>
        </edit-config>
        <resource-file src="resources/android/adaptiveicon/values/ic_launcher_background.xml" target="app/src/main/res/values/ic_launcher_background.xml" />
 </platform>

and also verify that you have the file "./values/ic_launcher_background.xml" that was generated by android studio is inside your resources folder inside your phonegap project

Upvotes: 1

navylover
navylover

Reputation: 13539

The values (res/android/values) folder contains colors.xml, ic_launger_background.xml, strings.xml, styles.xml

noticed ic_launger_background.xml, its not ic_launcher_foreground,check this.

Upvotes: 0

Related Questions