After trying many solution on web I didn't find solution to this problem.
> Task :app:mergeDebugResources FAILED
Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing
com.android.build.gradle.internal.res.ResourceCompilerRunnable
> Resource compilation failed. Check logs for details.
ParseError at [row,col]:[13,192]
Message: Attribute "xmlns:android" was already specified for element "LinearLayout".
My xml Linearlayout is not having "xmlns:android" attributes. Still it keep asking for the same.
Thanks in advance!
"xmlns:android" You have this line added twice in your code in LinearLayout. Also, Try Invalidate & Cache Restart and then run the code.
Related
I am trying to work with Jenkins however I cannot build the apk with it as I am having issue with AAPT2 and Gradle.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Multiple task action failures occurred:
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\b478eb984dbbd1317dab9bfd9689b3aa\transformed\appcompat-1.3.0\res\drawable-hdpi-v4\abc_list_divider_mtrl_alpha.9.png: AAPT: error: file not found.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\b478eb984dbbd1317dab9bfd9689b3aa\transformed\appcompat-1.3.0\res\drawable-xhdpi-v4\abc_list_divider_mtrl_alpha.9.png: AAPT: error: file not found.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\b478eb984dbbd1317dab9bfd9689b3aa\transformed\appcompat-1.3.0\res\drawable-mdpi-v4\abc_list_divider_mtrl_alpha.9.png: AAPT: error: file not found.
I already read tons of SO question that may share same issue to my case saying that it has something to do with the file path being too long but I still cannot find any solution.
UPDATE
I tried to change Android Studio Gradle home similar to what Jenkins is using and received similar error which indicates that it may really have something to do with long file path.
I think the final question will be how to change Jenkins Gradle Home?
You need to replace \ with \\ if you are giving path with jenkins in Windows.
May be if file path is too huge or that is the root cause you can try mounting the directory to a short path
EDIT : Based on your modified question :
Open Jenkins dashboard. Navigate to Manage Jenkins-> Configure System. Under the Global properties section add another environment variable named GRADLE_USER_HOME as shown below.
I ran into this exact issue, but unfortunately changing the GRADLE_USER_HOME environment variable did not help, as aapt2 appeared to ignore the change and still used Windows/system32/... for the cache location.
The problem was how I was running Jenkins as a service. In the service.msc settings, it was set to Log On as a Local System account, which set the USER_HOME variables to C:\Windows\System32. Because of this, the reason the error said that the file did not exist was because Jenkins/gradle did not have access to the System32 folder.
My fix was to change the log on method to 'This account', then enter a user account so Jenkins wasn't logged on as system anymore.
Recently I noticed that errors from data binding are not descriptive at all. Does anybody know how to find real error message instead of "follow-up" error message?
For example I'm getting errors like this:
...\build\generated\source\kapt\debug\com\company\example\DataBinderMapperImpl.java:18: error: cannot find symbol
import com.company.example.databinding.FragmentApplicationDetailsBindingImpl;
^
symbol: class FragmentApplicationDetailsBindingImpl
* What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
> java.lang.reflect.InvocationTargetException (no error message)
Only information I got from this is that error is in FragmentApplicationDetailsBinding or in fragment_application_details.xml layout file respectively.
Error caused the binding file to fail to generate so it's missing obviously. But no information what exactly went wrong during generation of FragmentApplicationDetailsBinding. :(
Try to clean and rebuild the project if its not work go to File->Invalidate caches / restart.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
Multiple task action failures occurred:
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.2-6040484-windows Daemon #12: Compile 'C:\Users\Abh\AndroidStudioProjects\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-th\values-th.xml' timed out, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.2-6040484-windows Daemon #9: Compile 'C:\Users\Abh\AndroidStudioProjects\MyApplication\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-en-rAU\values-en-rAU.xml' timed out, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.
This is the issue, I keep getting whenever I try to run flutter.
Could anyone provide a solution to this...please?
Without seeing the whole picture it is really hard to say, though, according to official documentation About AAPT issue seems to be related to your resource bundle. Check if you are using everything correct links to your resources. I believe issue have occurred in your .xml files values-th and values-en-rAU. It is a good idea if there are some strings marked as translatable check if there are corresponding values in those file
I'm reading the next book "Exploring Android" Version 0.7 https://commonsware.com/AndExplore/
and its Android sample project uses Data Binding library
So there is one layout and it contains line android:onClickListener="#{(v) -> holder.onRowClick.invoke(model)}">:
<androidx.constraintlayout.widget.ConstraintLayout
android:onClickListener="#{(v) -> holder.onRowClick.invoke(model)"
android:layout_width="match_parent"
android:layout_height="wrap_content">
But it won't compile.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
res\layout\todo_row.xml:13: AAPT: error: attribute android:onClickListener not found.
But some of such listeners works, e.g. android:onCheckedChanged, though Android Studio shows a warning:
I don't really like all this (lambdas, functions in xml) but it seems Android allows some of that and it can be used for writing MVVM based app
So why does android:onCheckedChanged work and for android:onClickListener I get "not found" error?
you miss } in the end.
should be
android:onClickListener="#{(v) -> holder.onRowClick.invoke(model)}"
You should try android:onClick="#{(v) -> holder.onRowClick.invoke(model)" instead of android:onClickListener="#{(v) -> holder.onRowClick.invoke(model)"
My project does not gradle it shows:
Error:Execution failed for
task ':app:mergeDebugResources'.
D:\Android\MatarealDesigen\app\src\main\res\values\styles.xml: Error: Unsupported node 'item'
Please go to res/values/styles.xml and find the error there. One of the tags called "item" is probably in the wrong place (it should be highlighted in red) :-)
In my case the name of one of the attributes was misspelled:
tye="layout"
instead of
type="layout"