How to clear Gradle scripts cache folder automatically? - android

Welcome all
I'm developing an automatic APK generator which compiles android apps using gradle console commands. I found this problem:
FAILURE: Build failed with an exception.
* What went wrong:
Failed to create parent directory '/root/.gradle/caches/2.2.1/scripts/settings_14c7jxprvkvxiv2ted70j3e0u' when creating directory '/root/.gradle/caches/2.2.1/scripts/settings_14c7jxprvkvxiv2ted70j3e0u/SettingsScript/buildscript'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
java.lang.Exception: Error processing Build command. Error code: 1
The problem is that directory /root/.gradle/caches/2.2.1/scripts/has hundreds of thousans of subdirectories generated and it has reached linux inode limit.
Why is gradle generating all those directories and how can i tell gradle to stop this? Whould be perfect if gradle has an option to delete/clean these cache directories automatically.
IMPORTANT: I'm not using android studio, all the process is automatized and using console commands (gradle assembleRelease)
Thx

Related

Error occurs after I have uploaded icons for app (in Android Studio with Flutter)

I have created app icons with a website called appicon. It provided icon files for both android(mipmap files) and ios devices(an Assets.xcassets file), which I added to their respective locations being (C:\Users\user\StudioProjects\i_am_rich(name of app)\android\app\src\main\res) for android and (C:\Users\user\StudioProjects\i_am_rich\ios\Runner) for ios.
When I run the program the following error is displayed:
FAILURE: Build failed with an exception.
* 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
C:\Users\user\StudioProjects\i_am_rich\build\app\intermediates\packaged_manifests\debug\AndroidManifest.xml:16: AAPT: error: resource mipmap/ic_launcher (aka com.example.i_am_rich:mipmap/ic_launcher) not found.
* 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 36s
Exception: Gradle task assembleDebug failed with exit code 1
I am learning Android Studio as the IDE with flutter, as a beginner, so I don't understand the problem nor what I have to do to fix it.
Help and, possibly, an explanation would be greatly appreciated :)
The website you mentioned does generate correct names and correct order of directories it seems. so most probably this is an issue with where you have put your files or the name of the files.
The 5 directories of icons must be copied to android\app\src\main\res folder.
and make sure in each directory you have a file called ic_launcher
if all is correct, please run flutter clean command and try again.
also by anychance the webisite generating incorrect files, try using this web site AndroidAssetStudio

Flutter failed to create parent directory

I formatted my PC and kept flutter sdk location in the same spot. The only difference was the name of the user folder. Before it was called "thesl", but now it's "bscho". Whenever I go to build my flutter application, I get this:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Failed to create parent directory 'C:\Users\thesl' when creating directory 'C:\Users\thesl\OneDrive\dev\redlino\redlino\android\app\build\intermediates\flutter\debug\flutter_assets'
* 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 1s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
The path of my Flutter SDK is: C:\dev\flutter
The path of my Flutter app (where the pubspec.yaml is located) is: C:\dev\redlino\redlino (yes the two redlino's are there on purpose)
It also doesn't help that my project files used to be in OneDrive which I have since uninstalled.
I fixed my problem by deleting the build folder in the android/app directory.
In android/app there is build.gradle.
Try delete it.
I'm also facing the same issue and resolve it by deleting the build folder in the android/app directory.
I'm talking about build folder not build.gradle file. So be careful while deleting.

Failed to create parent directory 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Android Studio\.gradle' LibGDX

I am using LibGDX to run an app an my pc. As of right now only the android app configuration works... Here is an example of what happens when I run the Gradle task "desktop:run"
'desktop:run'...
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type CrossBuildFileHashCache using BuildSessionScopeServices.createCrossBuildFileHashCache().
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 1s
Failed to create parent directory 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Android Studio\.gradle' when creating directory 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Android Studio\.gradle\4.0\fileHashes'
Task execution finished 'desktop:run'.
I think this may be because I am not running android studio as an administrator, but I don't know how to do that. I have already tried manually creating the .gradle folder (but Windows won't let me do that) and reinstalling android studio but there is no difference.

react native run android in emulator throws erro

i install react native and open a new project.
i try to run
react-native run-android
and I get this error
PS E:\Projects\React native\myapp> react-native run-android
Scanning 574 folders for symlinks in E:\Projects\React native\myapp\node_modules (27ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
FAILURE: Build failed with an exception.
* Where:
Build file 'E:\⌠°σΘΘ≈ΦΘφ\⌠°σΘΘ≈ΦΘφ ≈Θ⌡\React native\myapp\android\app\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Your project path contains non-ASCII characters. This will most likely cause the build to fail on Windows. Please move your project to a different directory. See http://b.android.com/95744 for details. This warning can be disabled by adding the line 'android.overridePathCheck=true' to gradle.properties file in the project directory.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.877 secs
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
As you can see from the error you need to move your project to a different directory with no non-ASCII characters.
Your project path contains non-ASCII characters. This will most
likely cause the build to fail on Windows. Please move your project
to a different directory. See http://b.android.com/95744 for details

Android Studio R Cannot be Resolved - Error on Clean and Gradle Build

I am currently working on an app for my own personal use but have 1000001 problems with Android Studio - now R cannot be resolved - and cleaning gives the result below:
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
Error: Failed to run command:
C:\Users\William\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe s -i C:\Users\William\Dropbox\111 WORKSPACES 111\Android Studio\Legacy\Notifications Alarm\2015-03-24 AndroidStudioProject\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.3\res\drawable-xhdpi\abc_textfield_search_activated_mtrl_alpha.9.png -o C:\Users\William\Dropbox\111 WORKSPACES 111\Android Studio\Legacy\Notifications Alarm\2015-03-24 AndroidStudioProject\app\build\intermediates\res\debug\drawable-xhdpi-v4\abc_textfield_search_activated_mtrl_alpha.9.png
Error Code:
42
Output:
C:\Users\William\Dropbox\111 WORKSPACES 111\Android Studio\Legacy\Notifications Alarm\2015-03-24 AndroidStudioProject\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.3\res\drawable-xhdpi\abc_textfield_search_activated_mtrl_alpha.9.png ERROR: Unable to open PNG file
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 17.777 secs
Above is the error message I keep on receiving when I clean my project. I can't find any XML errors, I have no foreign bodies in my resources except the launcher picture, and I can't find my R file anywhere - let alone reference it without error. The above error points to a
abc_textfield_search_activated_mtrl_alpha.9.png
That I have found and deleted - I don't think this is the right solution as the error persists. I have update Android Studio synched the Gradle and everything I have seen from my research. I really don't know how to handle this.
Thank you.

Categories

Resources