Failed to create MD5 hash for file content - android-studio

Out of nowhere gradle started to fail for a specific project of mine, with the current error:
\`\* What went wrong:
There was a failure while populating the build operation queue: Failed to create MD5 hash for file content.
Failed to create MD5 hash for file content.
Input/output error
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
com.intellij.openapi.externalSystem.model.ExternalSystemException: There was a failure while populating the build operation queue: Failed to create MD5 hash for file content.
Failed to create MD5 hash for file content.
Input/output error\`
I am running an android project using Android Studio
I searched but couldn't find anything useful, I already have tried:
Tried invalidate caches and restart on Android Studio
I tried to clean gradle, ./gradlew clean and rebuild the project
Restarted my laptop
Deleted the repository and cloned again (after rebooting device)
Changed the gradle version
Deleted .gradle/ and .idea/ files and build again
Updated Android Studio to Android Studio Electric Eel | 2022.1.1
With other project it working, but when I tried with this specific project its failing, I tried to give all permissions to this folder with the command: sudo chmod -R 777 /Projects/MyProject

Related

Failed to create install session with 'cmd package install-create -r -t --full -S'

I am getting an error when trying to run any app through Android Studio after upgrade to 3.5.1.
Installation did not succeed.
The application could not be installed.
Installation failed due to: 'Failed to create install session with 'cmd package install-create -r -t --full -S 2123967' '
I have found similar posts in StackOverflow, and these error messages seem to provide additional information or recommendation. However, the error message I get does not provide any other information. I have tried all the solutions I can find, but was not successful. Here is what I tried.
Clean uninstall (deleted all related files/folders) and reinstall of Android Studio
All apps fail to launch, even a new empty project created with no changes
Disable Instant Run (Option does not exist any more) / Update drivers / Update SDK / Rebuild the project / Sync with Gradle / Run Invalidate caches/restart
Launching to physical android device yields same installation error message
Emulator itself launches and functions without any issues
For this workstation only, problem started when I upgraded Android Studio, but it was a big jump from prior version as I did not run it in this workstation for months and months
I am open to any suggestions or ways to get any additional information to troubleshoot.

Android Studio java.nio.file.AccessDeniedException on CMake ExternalProject_Add

I am using Android Studio to build an app with the ndk, it has no java code. The code is written in C++ using CMake to build it. CMake, in turn, includes several projects such as boost etc downloaded, compiled and linked automatically from GitHub via ExternalProject_Add.
This works in Linux but I am now trying to get it to compile in windows Android Studio and I get an error in the middle of the Gradle sync process.
This is the error message:
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':app:generateJsonModelDebug'.
java.nio.file.AccessDeniedException: C:\Users\chris\Documents\pangolin\PrimeMatter\Apps\Dygd\Android\app.cxx\cmake\debug\arm64-v8a_deps\actor_framework-src.git\modules\libcaf_python\third_party\pybind\modules\tools\clang\objects\pack\pack-9372b77cb08267912558dd56012fa92b1022b634.idx
Try:Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
It looks like the pack....idx file has been marked read-only and if I go to the properties of that file to uncheck the read-only property then the compilation can continue to another idx file with the same problem (eventually it starts again with the first file, in a loop).

WSL gradle pre-pending current directory to Android SDK path

I have set the terminal on Android Studio to use WSL, specifically the Ubuntu one. Running builds from the IDE provided buttons works fine for my project. I decided to start using the terminal more and would prefer to run the builds from there, so I tried running
./gradlew tasks
at the root of the project to test out the Gradle I had installed with sdkman in WSL, but I get the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory '/mnt/c/Users/Henry-PC/Desktop/DJ-Cloud/C:\Users\Henry-PC\AppData\Local\Android\Sdk' does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
Any ideas as to what is wrong with?
Just had this issue myself, I had a local.properties file that specified an incorrect directory.
After removing it entirely gradle is able to locate the Android SDK using the exported ANDROID_HOME environment variable

Gradle build error using react native

I get this error when trying to run an app on an android emulator(Android Studio) from a console window:
$ react-native run-android
Scanning folders for symlinks in C:\Users\Brian\desktop\codervets\arrive-alive\aa_app\node_modules (27726ms)
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Starting a Gradle Daemon (subsequent builds will be faster)
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
The SDK directory 'c:\Users\eelia001\AppData\local\android\sdk1' does not exist.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 4m 51s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
And yet my sdk directory in android studio has the following directory:
C:\Users\Brian\AppData\Local\Android\Sdk
Has anyone else ran into this issue? If so, how do I fix it?
The error states:
The SDK directory 'c:\Users\eelia001\AppData\local\android\sdk1' does not exist.
And you say your SDK is in:
C:\Users\Brian\AppData\Local\Android\Sdk
Since those aren't the same directory, my guess is that's the problem. Are you perhaps logged in as the wrong user? You're going to want to check that ANDROID_HOME is set correctly.
So I'm not sure why it was setup the way it was, but the way to fix it is to go to Advanced System Settings → Environment variables. Thank you to #Rich Churcher for the link to a proper tutorial (it's outdated but the steps worked).

The APK file /Users/...../app/build/outputs/apk/app-debug.apk does not exist on disk

When I'm trying to test my android application on my android phone I get an error saying:
The APK file /Users/..../app/build/outputs/apk/app-debug.apk does not exist on disk.
Error while Installing APK
Also my Event logs are:
3:21:33 AM Gradle build finished in 57s 37ms
3:21:33 AM Session 'app': Error Installing APK
But I can clearly see the file /Users/..../app/build/outputs/apk/app-debug.apk after run and also my device is successfully connected in usb debugging mode on.
I'm using android studio 2.2
I have tried The APK file does not exist on disk all these methods too but it doesn't help me out in my case.
Also if I choose installDebug in Gradle properties (:app-->install-->installDebug) while running then app automatically get installed on my device, in that case my Event logs are:
3:25:02 AM Executing tasks: [installDebug]
3:25:12 AM Gradle build finished in 10s 70ms
Desperately looking for help, thanks.
I personally am not familiar with Android Studio, but did you try refreshing the page and trying to build the APK again? You could also maybe double-check if the file saved to a different folder.

Resources