Failed to copy full contents binding_classes.json in multimodule project - android

I have a multimodule project.
It worked fine for some times, but now I have this error from time to time:
Failed to copy full contents from 'C:\StudioProjects\project1\android\features\media\integration\build\intermediates\data_binding_base_class_log_artifact\debug\out\com.example.media-binding_classes.json' to 'C:\StudioProjects\project1\android\features\authorized_zone\feature\build\intermediates\data_binding_base_class_logs_dependency_artifacts\debug\com.example.media-binding_classes.json'
Clean & Rebuild soves the problem. Sometimes several rebuilds is required.
The error was initially in one module, some random changes in one of its layout seems to fix the problem. But now the same error appears in two other modules.
What doews this error means and how to fix it?

Related

Android Manifest error when trying to build project

I have been trying to build my project for sometime now and each time i try to build it i get the error and a file comes up that i have no idea about (debug/AndroidManifest.xml)
I have invalidated caches and restarted several times to no avail.
i have cleaned the project several times and still getting the same. I even went further to toggle my build variants between release and debug. Still no solution
see the screenshot below
aapt error unexcepted element.
it means in the wrong level.
check or remove it.
Your intent filter is in wrong place. Where it shows that you commented out the activity which was supposed to use the intent. remove the line and build again.

How to fix configuration of ':app:kaptDebugKotlin'

I'm having a problem getting my project to build. I get the message:
"A problem was found with the configuration of task ':app:kaptDebugKotlin'.
Cannot write to file 'C:\Workspace\depot\RM12\Mobile\AppSuite\Android\Working11\AppSuite\app\build\intermediates\data-binding\debug\bundle-bin' specified for property 'dataBindingArtifactOutputDir' as it is a directory"
This build issue won't occur for my first build after I clean the project, but if I try to build a second time I get this error. Which makes me do a clean and rebuild every time I need to run the project.
It occurs in some branches for me, while others don't seem to have this issue, and my coworkers have never seen this error. Which likely means this has something to do with my workspace.
I've done some research but haven't come across anything that has helped at all.
Please help me!!!

How to investigate why gradle build is using cached resource ids

If have a gradle (5.4.1) project (plugin 3.4.1) with two flavors (main and other) using the same sourceSets. I've come across an issue when renaming a resource id (in a layout XML). Here are the observations:
Android Studio 3.4.1 doesn't show any errors and works as expected, i.e. I can click through from kotlin code to the id in the layout xml.
Rebuilding the main flavor also works as expected (no compilation errors).
Rebuilding the other flavor gives a "unresolved reference" compilation error for the new ID. Gradle clean does not help. However, setting org.gradle.caching=false in the project-level gradle.properties does work (following Gradle sync, Clean, Rebuild). This explains why clean was not helping when caching was enabled.
On closer inspection of the R.java file, it seems to be using IDs from some rather old project state (presumably from the gradle cache stored in the user home directory). Now, I could just delete the gradle cache, but I'd rather find out why resource ID changes are not being processed properly. Whichever way Android Studio is running builds in the background, is working fine, just not when performing Build/Run etc.
All this investigation required a lot of trial and error: switching various gradle.properties settings one by one to see which one was leading to the problem, and I'm still no closer to finding the root cause of the problem.
What is the best approach to solving this type of problem, or is trial and error the only way?

Removing library from Gradle causes "no resource found" errors

Below I've attached 2 screenshots: the first one shows my gradle file, the second one shows the errors. When I remove the chatkit dependency, I get the errors in the second screenshot even though the library is not being used anywhere. Why is this happening?
have you performed a clean project before to re-build the app?
On menu build -> Clean project?

android studio cannot resolve symbol R [duplicate]

This question already has answers here:
"cannot resolve symbol R" in Android Studio
(100 answers)
Closed 7 years ago.
I've been working on an app and all was going well, everything was working fine. Then I modified some code in my main activity, and when I tried to run the app, there was an apparent error in my code and the build failed.
After this, all the references to my layout files were no longer working (i.e., R.layout.) R was red and hover over says "Cannot resolve symbol R".
Searching you will find dozens of posts that propose many fixes, like: Clean Project; Rebuild Project; Sync Project with Gradle Files; Invalidate Cashes / Restart; Check xml for errors, restart Studio, etc... I've tried them all.
NONE OF WHICH WORK IN MY SITUATION.
My code is working and without errors because I can create a new Android Studio project, and add my classes and resources. The new Android Studio project will run the the SAME CODE under a different package name.
I encountered this same problem a while back and I vaguely remember deleting something from my project folder (might have been a folder or file). I don't remember what I deleted, but it did fix the problem.
Thanks for any advice.
I finally got Android Studio to build without errors, but honestly I don't know how this happened. It was very puzzling that I could have a project that worked and several copies that didn't (I must have re-created my project 10 times from scratch) each time I would copy the project to an archive directory and start over. One of my build requirements was I needed to compile on Jelly Bean, and I think Android Studio sets some sort of defaults when you open a new project with a Blank Activity. Anyway, each time the R. error occurred the build warning would display this:
<style name="Base.Widget.AppCompat.Spinner.Underlined" parent="android:Widget.Material.Spinner.Underlined
But my code does not contain a spinner, so I really can't figure out where this is coming from. In fact I've tried to replace files in one of my inoperable saved projects with the files from my working copy (manifests, code, gradle.build, etc.) yet once inoperable, it seems a Studio project will remain that way.
I wish I could reproduce the problem but I cannot.
WTF! After thinking I had resolved this the problem, it is back again. From my working project I did 2 things. Added a very simple activity, and added it's reference to the manifest. Tried to run the project and get the SAME error again, referencing the a spinner. The Gradle build message is:
C:\CargoBay\Android\LandApp\app\build\intermediates\res\merged\debug\values-ldltr-v21\values-ldltr-v21.xml
Error:(3) Error retrieving parent for item: No resource found that
matches the given name 'android:Widget.Material.Spinner.Underlined'.
I removed the new code from my project, and it still won't build.
I don't know what to think now.
In Android Studio select your project folder, go to VCS / Local History / Show History. Show History will list any files that were moved or deleted, and give you an option to restore the file.
If you select your main activity code, it shows the history of code changes, and you can restore to previous code that was working.

Categories

Resources