Search Unity

No resource found that matches the given name (@drawable/app_icon)

Discussion in 'Unity Build Automation' started by Hosnkobf, Jul 11, 2018.

  1. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Hi,
    I have another problem with Cloud Build for Android.
    At the end of the compact log the following errors appear:
    In my project I use Google Firebase Cloud Messaging which comes along with some AndroidManifest.xml files.

    The main one looks like this:
    Code (csharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    3.           xmlns:tools="http://schemas.android.com/tools"
    4.           package="${applicationId}"
    5.           android:versionCode="1"
    6.           android:versionName="1.0">
    7.   <application android:label="@string/app_name"
    8.                android:icon="@drawable/app_icon"
    9.                android:theme="@style/UnityThemeSelector">
    10.     <!-- The MessagingUnityPlayerActivity is a class that extends
    11.          UnityPlayerActivity to work around a known issue when receiving
    12.          notification data payloads in the background. -->
    13.     <activity android:name="com.google.firebase.MessagingUnityPlayerActivity"
    14.               android:label="@string/app_name"
    15.               android:icon="@drawable/app_icon"
    16.               android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    17.       <intent-filter>
    18.         <action android:name="android.intent.action.MAIN" />
    19.         <category android:name="android.intent.category.LAUNCHER" />
    20.       </intent-filter>
    21.       <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    22.     </activity>
    23.     <service android:name="com.google.firebase.messaging.MessageForwardingService"
    24.              android:exported="false"/>
    25.   </application>
    26.  
    27. </manifest>
    28.  
    here the app icon location is defined... but AFAIK this is the same as in unity's default AndroidManifest... right?

    So, maybe the problem is that I only defined the "Default Icon" in the player settings !?
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Does your project build fine locally ?
     
  3. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    yes.
     
  4. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    AFAIK, Gradle is very strict about Android libraries accessing resources that are not defined in the library itself (for example: app_name or app_icon). Not really sure how this works locally on your machine (are you also building using Gradle?)
     
  5. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    So, I figured out all problems now.
    I had to update the firebase plugin, which was the source of the problems (because the AndroidManifests of it couldn't be merged).
    Then I still had another problem with Internal build method (google already knows about it). But with Gradle I can finally build.
     
  6. b3da

    b3da

    Joined:
    Oct 4, 2018
    Posts:
    3
    I had this problem when I updated my project to latest version of unity. It took me much time to find the problem. Simply replace @drawable with @Mipmap (with lowercase m) in AndrdoidManifest.xml in plugin folder.
     
  7. temoorwali

    temoorwali

    Joined:
    Feb 16, 2015
    Posts:
    3
    It works :)
     
  8. jpnavarrofennell

    jpnavarrofennell

    Joined:
    Jul 23, 2012
    Posts:
    6
    Works!
     
  9. vuthang

    vuthang

    Joined:
    Mar 7, 2017
    Posts:
    50
    Perfect. :D