Gradle suddenly doesn't build Arm8Release any more - android

When I say
./gradlew installArm8Release
I get this error:
:app:generateJsonModelArm8Release UP-TO-DATE
:app:externalNativeBuildArm8Release FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:externalNativeBuildArm8Release'.
> java.io.FileNotFoundException: D:\TestApp\app\.externalNativeBuild\cmake\arm8Release\arm64-v8a\android_gradle_build.json (The system cannot find the file specified)
I believe my Gradle configuration has somehow been corrupted because as you can see it says on :app:generateJsonModelArm8Release that it is up to date but as you can see from the error below android_gradle_build.json isn't there at all.
The following line works fine, though:
./gradlew installArm7Release
It's only Arm8Release that fails although it used to work before. This makes me think that somehow something got corrupted. I have already tried the following:
./gradlew clean
./gradlew cleanBuildCache
All to no avail. It refuses to build the Arm8Release target. I have also tried deleting the .externalNativeBuild directory and running
./gradlew wrapper
again. But it didn't solve the issue either.
I have also rebooted the system to make sure any gradle daemon is gone but the error is still there.
I'm pretty much out of ideas now. All targets are working fine except Arm8Release. What else can I try?

Just for the record: Deleting really everything from my build directory except the source and resource files solved this issue. So it seems like
./gradlew clean
./gradlew cleanBuildCache
doesn't really clean everything...

In Android Studio 3.5 (and probably above), that missing file is under a .cxx folder, so deleting the build folder has no effect. Cleaning build doesn't help either. Instead an invalidate cache and restart did the trick for me.

Just add --rerun-tasks to your gradlew command, e.g.
./gradlew installArm8Release --rerun-tasks

just restart Android Studio, it worked for me.

Related

Execution failed for task ':shared:podInstall'

I am very new to KMM (Kotlin Multiplatform Mobile) and iOS development (including CocoaPods). I have come across the following build error in Android Studio.
Execution failed for task ':shared:podInstall'.
java.io.IOException: Cannot run program "pod" (in directory "/Users/.../AndroidStudioProjects/.../iosApp"): error=2, No such file or directory
The directory definitely exists and I seem to be able to manually run pod commands from within the directory. I am not sure but it seems like this problem came about when I updated the Kotlin plugin from 1.5.0 to 1.5.10. This problem occurred even when starting a completely new KMM project.
I thought it might have something to do with Android Studio not being able to find the pod command so I added it to the path but that didn't seem to do anything. Any help with this would be appreciated.
Check your Gradle JDK :
Android Studio > Preferences > Build, Execution, Deployment > Build Tools > Gradle
Then select Gradle JDK -> Embedded JDK
Maybe you must execute in command line :
./gradlew :shared:podInstall
Have you tried File > Invalidate Cache and Restart?
I had exactly same issue, but It got fixed after invalidate cache and restart.

How to sync gradle in React Native (android)?

I tried ./gradlew build but that didn't work, because it doessnt see the changes made in gradle file. The only thing that works for me is restarting and invalidating cache, but there must be a better way to do it.
Thank you
You should try running ./gradlew clean before building.
change directory to /{your project}/android then run below commands
./gradlew clean
./gradlew build
Note :-
you will get error : ./gradlew: No such file or directory
if you are trying gradlew commands outside android folder.
also check this : Why run 'gradle clean build' instead of 'gradle build'?

debug directory does not exist error running React-native's AwsomeProject

I'm trying to create a react-native android app following react-native "Getting started" here but when I try to run it both through CLI and with Android studio it gives me this error:
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
AAPT: C:\Windows\System32\AwsomeProject\android\app\build\intermediates\res\merged\debug: error: directory does not exist.
I tried deleting the build folder, cleaning the project and re-running it but it doesn't work.
How can I solve this?
If I understand your situation right:
There is absolutely no issue in your Java and XML.
Your project built just fine before this.
You tried to remove the build cache.
In addition to above you should remove the .gradle directory as well.
Unfortunately, some react-native modules have their own build directory inside the node_modules/ directory, so it is possible that you didn't clear the build cache for them.
Of course, it's really hard to go into each module and remove the build cache manually each time, but fortunately, you can change this behavior by adding to build.gradle file something like below:
allprojects {
// ...
buildDir = "${rootProject.rootDir}/.build/${project.name}"
}
Note: This tells gradle to use the same build directory for all projects.
I prefer ".build" as build directory but you may want to change that to "build" in above.

Android resource compilation failed after android gradle version update

I am developing an android app, everything was going fine until i updated gradle version to 3.2. Whenever i try to build or sync the project it shows 'Android resource compilation failed'
Output: C:\Users\User\AndroidStudioProjects\MyApp\base\build\intermediates\incremental\mergeDebugFeatureResources\merged.dir\values\values.xml:2316: error: <item> inner element must either be a resource reference or empty.
Command: C:\Users\User\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\fc444429c9ac9f1db8d9bb3790bf9413\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \ -o \ C:\Users\User\AndroidStudioProjects\MyApp\base\build\intermediates\res\merged\feature\debug \ C:\Users\User\AndroidStudioProjects\MyApp\base\build\intermediates\incremental\mergeDebugFeatureResources\merged.dir\values\values.xmlDaemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0\
The error comes up in this line
<item name="textviewprofile" type="id">Logout</item>
I tried to delete the logout element, but the changes does not reflect after build and it still shows up.It says you cannot edit values.xml. I also tried to clean and invalidate the project but that also didn't worked. I have been trying it for several days but cannot fix it.
Any help would be appreciated
Thanks in advance for it
did you already tried deleting the .gradle file located in your root project dir? That sometimes works for me.
Gradle keeps a cache of the task it runs so by deleting the .gradle folder you are invalidating the gradle cache and forcing to redo it again.

React-native run-android fail on :app:processDebugResources

I recently added push notification to my app using react-native
and since at seemingly random times I get messages such as in the added photo
Execution failed for task
':app:processDebugResources'.
java.io.IOException: Could not delete folder ..\android\app\build\generated\source\r\debug\com\facebook\drawee
Did anyone experienced something like that or has a solution?
Run this command to clean project:
cd android && gradlew clean
After, run the following command to run project again:
cd .. && react-native run-android
I had the same problem. I changed the permissions of the project folder and all subfolders to full access from all users, and now it seems to work!
So apparently the packager can cause two types of file-access errors to occur during gradle syncing and building:
1) "EPERM: operation not permitted, lstat"
2) "java.io.IOException: Could not delete path"
These are actually two separate problems -- one of them caused by the watchman npm module, and the other caused by the packager itself.
Instructions to solve them can be found here: https://stackoverflow.com/a/47420765/2441655
If you are running the application in android device then go to the android director in your react native project then Delete the build folder/(Directory) then again run the project.Its work for me
The path of the build folder
YourProject/android/

Categories

Resources