Failed to re-package resources

I got thise error when I want to build me apk, what is the problem? en how can i fix it?

This says the console:

Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\Users\Bart\AppData\Local\Android\sdk\build-tools\22.0.1\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S “res” -I “C:/Users/Bart/AppData/Local/Android/sdk\platforms\android-22\android.jar” -F bin/resources.ap_

stderr[
AndroidManifest.xml:7: error: Error: No resource found that matches the given name (at ‘icon’ with value ‘@drawable/ic_launcher’).

AndroidManifest.xml:7: error: Error: No resource found that matches the given name (at ‘theme’ with value ’ @ /Theme.Sample’).

AndroidManifest.xml:9: error: Error: No resource found that matches the given name (at ‘resource’ with value ’ @ /searchable’).

]
stdout[
Configurations:
(default)
ldpi-v4
hdpi-v4
xhdpi-v4
xxhdpi-v4
xxxhdpi-v4

Files:
drawable\app_icon.png
Src: () res\drawable\app_icon.png
Src: (ldpi-v4) res\drawable-ldpi\app_icon.png
Src: (hdpi-v4) res\drawable-hdpi\app_icon.png
Src: (xhdpi-v4) res\drawable-xhdpi\app_icon.png
Src: (xxhdpi-v4) res\drawable-xxhdpi\app_icon.png
Src: (xxxhdpi-v4) res\drawable-xxxhdpi\app_icon.png
values\strings.xml
Src: () res\values\strings.xml
values\version.xml
Src: () res\values\version.xml
AndroidManifest.xml
Src: () AndroidManifest.xml

Resource Dirs:
Type drawable
drawable\app_icon.png
Src: () res\drawable\app_icon.png
Src: (ldpi-v4) res\drawable-ldpi\app_icon.png
Src: (hdpi-v4) res\drawable-hdpi\app_icon.png
Src: (xhdpi-v4) res\drawable-xhdpi\app_icon.png
Src: (xxhdpi-v4) res\drawable-xxhdpi\app_icon.png
Src: (xxxhdpi-v4) res\drawable-xxxhdpi\app_icon.png
Type values
values\strings.xml
Src: () res\values\strings.xml
values\version.xml
Src: () res\values\version.xml
Including resources from package: C:\Users\Bart\AppData\Local\Android\sdk\platforms\android-22\android.jar
applyFileOverlay for drawable
applyFileOverlay for layout
applyFileOverlay for anim
applyFileOverlay for animator
applyFileOverlay for interpolator
applyFileOverlay for transition
applyFileOverlay for xml
applyFileOverlay for raw
applyFileOverlay for color
applyFileOverlay for menu
applyFileOverlay for mipmap
Processing image: res\drawable\app_icon.png
Processing image: res\drawable-ldpi\app_icon.png
Processing image: res\drawable-hdpi\app_icon.png
Processing image: res\drawable-xhdpi\app_icon.png
(processed image res\drawable\app_icon.png: 84% size of source)
Processing image: res\drawable-xxhdpi\app_icon.png
(processed image res\drawable-ldpi\app_icon.png: 90% size of source)
Processing image: res\drawable-xxxhdpi\app_icon.png
(processed image res\drawable-hdpi\app_icon.png: 73% size of source)
(processed image res\drawable-xhdpi\app_icon.png: 72% size of source)
(processed image res\drawable-xxhdpi\app_icon.png: 55% size of source)
(processed image res\drawable-xxxhdpi\app_icon.png: 55% size of source)
(new resource id app_icon from drawable\app_icon.png #generated)
(new resource id app_icon from ldpi-v4\drawable\app_icon.png #generated)
(new resource id app_icon from hdpi-v4\drawable\app_icon.png #generated)
(new resource id app_icon from xhdpi-v4\drawable\app_icon.png #generated)
(new resource id app_icon from xxhdpi-v4\drawable\app_icon.png #generated)
(new resource id app_icon from xxxhdpi-v4\drawable\app_icon.png #generated)
]

Thanks!

You didn’t post your AndroidManifest.xml, but from the looks of the errors you posted, it looks like you’re using resource identifiers that cannot be found anywhere.

In a traditional Android project, you add new assets into the projects (new strings, new images, etc) and the IDE will invoke Android tools that generate the R.java file, which is just a big listing of all the resources you use in your project by their name, mapped to an identifier.

I think this class is transformed at build time and used to lookup resources according to their IDs.

All is fine except for the fact that in the Unity project, you don’t have the R.java file so i don’t think you can access resources according to their IDs in the AndroidManifest.xml

I am not 100% sure i am right about this one… @Yury-Habets can probably comment for sure :slight_smile:

Another possibility is that those resources are simply missing from your project :slight_smile:

This is the documentation forum section; not the place to be asking for compilation help.

Looks like you have some plugins and/or manifest overridden. In that case, you need to check your plugins (they may need some configuration) and manifest. The error message is here:

AndroidManifest.xml:7: error: Error: No resource found that matches the given name (at ‘icon’ with value ‘@drawable/ic_launcher’).

AndroidManifest.xml:7: error: Error: No resource found that matches the given name (at ‘theme’ with value ’ @ /Theme.Sample’).

AndroidManifest.xml:9: error: Error: No resource found that matches the given name (at ‘resource’ with value ’ @ /searchable’).

I had this problem when I update 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.

NOT WORK IN UNITY 2019