I've written an instrumented test. When I run it I get an error:
/Users/ilamasin/StudioProjects/ecwid/general/build/intermediates/packaged_res/debug/drawable/horizontal_divider_with_padding.xml:6:
AAPT: error: resource dimen/horizontal_divider_thickness (aka
com.ecwid.android.reports.test:dimen/horizontal_divider_thickness) not
found.
It's my drawable in project and it exists. My project runs and works. But test doesn't. Did anyone has this error? I use Junit and Mockito (Sorry for my English)
just go to dimen file and add value to this-:
res->values->dimen and give value to dimen/horizontal_divider_thickness
or go to drawable file and pass value i.e 15dp or 20dp whatever you want to add.
Related
Trying to build the app but have got the error: The error Confugure image asset1
Confugure image asset2
Confugure image asset3
ERROR:C:\Users\Alex\AndroidStudioProjects\Lm2\app\src\main\res\mipmap-anydpi-v26\ic_launcher_round.xml:3: AAPT: error: resource mipmap/ic_launcher_background (aka com.example.lm2:mipmap/ic_launcher_background) not found.
How can I resolve this?
I hope you have
put your launcher icons into the mipmap folder where they should always go.
added your adaptive icon to the app’s manifest.xml for “android:icon” (android:roundIcon) attribute
.
Fist hand try: Clean your project and Rebuild
Probable Issue reason: Malformed XML:
Solution:
Check if you have anything duplicated by mistake in your XML
Try Analyze > Inspect Code it will redirect you to the exact error.
I want to make a settings activity for an android app. I used the standard activity for the settings but I keep getting the error:
\.gradle\caches\transforms-2\files-2.1\e3ce7e7cf0568bf54350349961cc10db\preference-1.1.1\res\values\values.xml:257:5-336:25: AAPT: error: duplicate value for resource 'attr/defaultValue' with config ''.
I think it has something to do with the androidx.preference.PreferenceFragmentCompat because the error disappears when I remove the dependency on android.preference:preference:1.1.1. Do you know how to fix this?
I figured it out. The DevaultValue was already defined by me in the res/attr/ folder. deleting this value makes it work.
If you already have a field with defaultValue in attrs file, rename it and try rebuild it. It works
I've just tried to generate signed apk for one of my projects!
The project works good, but when I try to generate signed APK it shows me an error: Error: Expected resource of type drawable [ResourceType]
You need pass Drawable in setBackgroundDrawable() method instead of int value
Like below code
getWindow().setBackgroundDrawable(ContextCompat.getDrawable(this,R.drawable.ic_launcher_round));
Generally, AAPT is packaging an application with fixed resource id, and the id value is starting with "0x7f".
I want to replace this integer value with other value, like "0x6f" or something.
I found the code line to handle this, and modified the aapt code. (path : /frameworks/base/tools/aapt/)
But, when building an application, I got the build error message like:
/apps/myapps/AndroidManifest.xml:9: error: Error: No resource found that matches the given name (at 'icon' with value '#drawable/ic_launcher_app')."\
Is there any way to solve this build error ?
According to this Android resources dev page you should never modify the R file yourself as it is generated automatically
Caution: You should never modify the R.java file by hand—it is generated by the aapt tool when your project is compiled. Any changes are overridden next time you compile.
That means ic_launcher_app image not in your drawable folder. And also if you change image format manually like .jpg to save as .Png without using any software that AAPT(while compile resources into binary assets) issue will occur.so use proper image formats.
I'm getting this error when trying to build the application. The xml editor did not highlight both error as missing. As the file/string are already there.
android-apt-compiler: [XXX]
D:\private\xxx\android\XXX\src\AndroidManifest.xml:35: error: Error:
No resource found that matches the given name (at 'icon' with value
'#drawable/ic_launcher').
android-apt-compiler: [XXX]
D:\private\xxx\android\XXX\src\AndroidManifest.xml:233: error: Error:
No resource found that matches the given name (at 'value' with value
'#string/FacebookAppID').
The project structure is like this:
ProjectFolder
|-external_lib
|-src
|-src (actual source)
|-res
|-...
I can confirm that both file is already in the project. As I use IntelliJ, I could just Ctrl + click then it open those files for me. However, I'm still getting this error.
I checked with both Google and SO. Most of the issues were about not having the files or storing in different folders. Which I can ensure that it is in the right place alongside hundred other files and strings.
Another issue is about % sign in strings.xml. I tried searching for "%" and nothing is found in the file.
Shutting down IDE and reopen it doesn't help, nor rebuilding the project. How could I get the app to build?
Look for any error message during the resource compilation.
Sometimes, if you have resource filenames containing illegal characters (such as underscores or uppercase letters), the whole process fails almost silently, and the IDE can't find any resources anymore.
I'm not sure that it's what is happening in your case, but I did eventually encounter such issues...