Gradle : failed to create directory - android

[I am a newbie and getting some errors like 1] gradel:failed to create directory 2] Error:Gradle: Execution failed for task ':app:processDebugResources'.
Failed to execute aapt 3] Error:Gradle:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details . I have tried changing the build version but it didn't worked i even tried to change aapt and many things but nothing worked for me.]1

You need to Provide Your Gradle.Build Too so we can see what is wrong.
Now, Check if The compileSdkVersion is the Same as buildToolsVersion
If buildToolsVersion is "21.0.3" Your compileSdkVersion needs to be "21"
Check and see what's what

Related

Execution failed for task ':google_sign_in:verifyReleaseResources'

Ok so I have been building my flutter application , however, i can't figure you what to do in case of this error. I have been following this blog https://flutter.dev/docs/deployment/android , for the release build of my app .Everything worked fine , until i added
flutter build apk --split-per-abi
It gave me the following error,
FAILURE:
Build failed with an exception. '
Execution failed for task ':google_sign_in:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/shuvayan/Desktop/test/srijan2020-app/build/google_sign_in/intermediates/res/merged/release/values/values.xml:276:
error: resource android:attr/fontVariationSettings not found.
/Users/shuvayan/Desktop/test/srijan2020-app/build/google_sign_in/intermediates/res/merged/release/values/values.xml:277: error: resource android:attr/ttcIndex not found.
error: failed linking references.
I had the facebook_flutter_plugin and google_sign_in plugins installed for my application.
After some google search a github issue pointed me to add in the android/app/build.gradle to force use compileSDKVersion 27 even it was given 28.
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
However, this didn't solve my issue and my the error's still showing up. I would appreciate a little help on this matter.
The problem lies with the plugin with it's specified dependency of compileSdkVersion which have been set to Android 27
update to the most recent version of the plugin, as of now 4.2.0
References:
https://pub.dev/packages/google_sign_in#-changelog-tab-
https://github.com/flutter/plugins/blob/master/packages/google_sign_in/google_sign_in/android/build.gradle
https://github.com/flutter/flutter/issues/32595

Execution failed for task ':react-native-youtube:verifyReleaseResources'

While making build of react native app I get the following error.
* What went wrong:
Execution failed for task ':react-native-youtube:verifyReleaseResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
And after this the build is failed.Why this came and what is the possible solution for this problem?
Reason for the error:
You have installed react-native-youtube as a dependency, And the reason for this error is that the configurations of your android/app/build.gradle and node_modules/react-native-youtube/android/build.gradle mismatch.
Solution
Navigate to node_modules/react-native-youtube/android/build.gradle
Edit and keep the compileSdkVersion buildToolsVersion minSdkVersion
targetSdkVersion same as you have in android/app/build.gradle
Sync the project again.
Run ./gradlew assembleRelease from the terminal.
Edit your node_modules/react-native-youtube/android/build.gradle file like this:
https://github.com/hwjfordev/react-native-youtube/commit/606401aa236e94394736fcc43ce9a4e29bf6a129

React Native Android Release Build Failing - Gradle

I've got a rather complicated project some of which is older code from the past year or so which in React Native time is forever.
The regular debug build is working fine but the release build has errors. I've cobbled together answers from other places to make it as far as I have but I don't know how to get past this last bit.
I keep getting a bundling error where aapt will fail because it doesn't bundle the resources properly.
Example of error code:
> Task :app:bundleReleaseJsAndAssets
Scanning folders for symlinks in /media/user/1546c7ef-f386-4baa-90d5-cbd87092d3e31/home/user/Code/React-Native/timesavr/node_modules (9ms)
Scanning folders for symlinks in /media/user/1546c7ef-f386-4baa-90d5-cbd87092d3e31/home/user/Code/React-Native/timesavr/node_modules (6ms)
warning: the transform cache was reset.
Loading dependency graph, done.
bundle: Writing bundle output to: /media/user/1546c7ef-f386-4baa-90d5-cbd87092d3e31/home/user/Code/React-Native/timesavr/android/app/build/intermediates/assets/release/index.android.bundle
bundle: Done writing bundle output
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
/home/user/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.0.2.aar/28fa7b5f2db0b5e014559f7cf36ab4c7/res/values-v26/values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.
/home/user/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.0.2.aar/28fa7b5f2db0b5e014559f7cf36ab4c7/res/values-v26/values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.
/home/user/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.0.2.aar/28fa7b5f2db0b5e014559f7cf36ab4c7/res/values-v26/values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
error: failed linking references.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-image-resizer:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
Building upon GenericJam's answer, you can do this programatically to all sub libraries by doing something like this in your project build.gradle file:
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
The way to solve this that worked for me is to dive into the node_modules code for the supporting libraries that are triggering the error.
You will need to go into node_modules/project-name/android/build.gradle and change this
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
...
}
to whatever the sdk version is in your /android/app/build.gradle is.
For example:
android {
compileSdkVersion 27
buildToolsVersion "27.0.1"
...
}
Hopefully this will be fixed in React Native so this workaround isn't necessary.
Edit: I suspect Petter's solution is the better one although I haven't tried it myself. Probably try that one first and if it doesn't work, try this next.

Android Project imported in android studio giving exception

I imported an eclipse project in android studio.
On running the app, its giving the below error.
As suggested in some links, I run the command 'gradlew.bat clear' and after that restarted my android studio, but it didn't worked.
Please help me out
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_45\bin\java.exe'' finished with non-zero exit value 2
Look if you have duplicates in gradle settings like this:
compile 'com.google.android.gms:play-services:+'
compile files('libs/google-play-services.jar')
that could also cause this issue. Remove one of lines if you have this.
changing java version to 1.7 and deleting concerning libs files helped me getting rid of the above exception.
I changed the target version in my build.gradle file from targetSdkVersion 22 to targetSdkVersion 23 as i was using compileSdkVersion 23. The error went away and the app ran successfully after syncing ad rebuilding. hope this helps someone

Execution failed for task ':app:compileDebugNdk' when trying to compile Android Studio project with NDK source code

No matter how many tutorials I followed, every time I try to make a project containing C source files gradle outputs the error:
Error:Execution failed for task ':app:compileDebugNdk'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\svprdga\Downloads\android-ndk-r10d_x86\ndk-build.cmd'' finished with non-zero exit value 2
For example, I downloaded the following tutorial, which also throws the same error:
https://github.com/mpospelov/android-studio-ndk-hello-world
I have seen the following questions, but I not understand exactly what I am supposed to do:
execution failed for task ':app:compileDebugNdk' failed to run this command ndk-build.cmd
Can't build project with android-ndk and Android Studio
Any help?
Maybe this answer will help: https://stackoverflow.com/a/28810873
"Try to add empty .c file to your jni dir (like empty.c)". It worked in my case - Android Studio 1.1.0 with android-ndk-r10d-windows-x86_64
The version code of compileSdkVersion and buildToolsVersion should be consistent in the module build.gradle file.
eg.
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
...
}

Categories

Resources