Well, after too much googling for about two days and trying most of the recommended work arounds suggested on this platform, my problem is not solved yet!!
It goes like this...
I have started android app development recently with Android Studio on Ubuntu 12.04 LTS.
Whenever I open my project, gradle build always finishes with following two errors;-
Executing tasks: [clean, :app:compileDebugJava]
Configuration on demand is an incubating feature.
:app:clean
:app:preBuild
:app:preDebugBuild
:app:checkDebugManifest
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
/home/vivek/AndroidStudioProjects/MyApplication3/app/src/main/res/drawable-mdpi/ic_launcher.png: Error: Cannot run program "/home/vivek/Documents/android-studio/sdk/build-tools/21.0.1/aapt": error=2, No such file or directory
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> /home/vivek/AndroidStudioProjects/MyApplication3/app/src/main/res/drawable-mdpi/ic_launcher.png: Error: Cannot run program "/home/vivek/Documents/android-studio/sdk/build-tools/21.0.1/aapt": error=2, No such file or 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: 6.776 secs
Related
> Executing tasks: [:app:assembleDebug]
>
> WARNING: The option 'android.enableAapt2' is deprecated and should not
> be used anymore. Use 'android.enableAapt2=true' to remove this
> warning. It will be removed at the end of 2018. :app:preBuild
> UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugAidl
> UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE
> :app:checkDebugManifest UP-TO-DATE :app:generateDebugBuildConfig
> UP-TO-DATE :app:prepareLintJar UP-TO-DATE
> :app:mainApkListPersistenceDebug UP-TO-DATE
> :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources
> UP-TO-DATE :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT error: check logs for details
* 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 13s 9 actionable tasks: 1 executed, 8 up-to-date
In gradle.properties change android.enableAapt2=false to true
You can actually have problems in the resources but these will not be displayed if you do not correct this problem first:
The option 'android.enableAapt2' is deprecated and should not be used
anymore. Use 'android.enableAapt2 = true' to remove this warning. It
will be removed at the end of 2018.
within your gradle.properties file that is located in the root of the project, replace:
android.enableAapt2
with:
android.enableAapt2 = true
Try updating your gradle plugin. Fixed my error.
within gradle.properties file that is located in the root of the project,
I have just commented on this line, now works perfectly
android.enableAapt2 = true
Please make sure that the images and icons you included in your project is Imported by android studio or Drawable importer plugin.
to install this plugin you have to go File>setting> plugin.
then type Drawable importer
Your problem is with android.enableAapt2 .
You should check what's missing or the package is imported correctly.
Search for file android.enableAapt2 or that keyword.
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
I recently updated my version of android studio, when i create an activity now i get this error. Can someone explain this error to me?
Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
Configuration on demand is an incubating feature.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\eche\AppData\Local\Android\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72310Library
:app:prepareComAndroidSupportConstraintConstraintLayout101Library
:app:prepareComAndroidSupportDesign2310Library
:app:prepareComAndroidSupportRecyclerviewV72310Library
:app:prepareComAndroidSupportSupportV42310Library
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources
AGPBI: {"kind":"error","text":"No resource identifier found for attribute \u0027srcCompat\u0027 in package \u0027com.drawscape.drawscape\u0027","sources":[{"file":"C:\Users\eche\Documents\Drawscape 2.05\app\src\main\res\layout\activity_adminoptions.xml","position":{"startLine":24}}],"original":"","tool":"AAPT"}
C:\Users\eche\Documents\Drawscape 2.05\app\build\intermediates\res\merged\debug\layout\activity_adminoptions.xml:25: error: No resource identifier found for attribute 'srcCompat' in package 'com.drawscape.drawscape'
FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
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: 5.875 secs
All projects were working fine previously but have all suddenly stopped working. This error is displayed when building any project in the Android Studio.
I did not make any changes to what was previously working. So, I also don't know what triggered this.
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\DELL14\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output D:\AndroidDevelopment\Sunshine\Lynx09\app\build\intermediates\dex\debug --input-list=D:\AndroidDevelopment\Sunshine\Lynx09\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
1
Output:
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
This is what was in the gradle console for a different project. Its almost the same for all of the projects I try to run.
Executing tasks: [:app:assembleDebug]
Configuration on demand is an incubating feature.
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42103Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:preDexDebug
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\DELL14\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --output D:\AndroidDevelopment\Sunshine\Sunshine\app\build\intermediates\pre-dexed\debug\support-annotations-21.0.3-8197c74ea8b8656ed6c95d15295a239b84e4ed49.jar C:\Users\DELL14\AppData\Local\Android\sdk\extras\android\m2repository\com\android\support\support-annotations\21.0.3\support-annotations-21.0.3.jar
Error Code:
1
Output:
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
* 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: 32.438 secs
Hi I have installed the latest version of Android Studio on Windows 7 32-bit.
I have created a welcome app, but when I try to test it using AVD it's not launching, instead it's showing the error below:
Executing tasks: [:app:assembleDebug, :app:assembleDebugTest]
Configuration on demand is an incubating feature.
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72102Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42102Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources
:app:generateDebugSources
:app:compileDebugJava
:app:preDexDebug
The system cannot find the path specified.
The system cannot find the path specified.
FAILED
The system cannot find the path specified.
The system cannot find the path specified.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
E:\Android\AndroidStudio\sdk\build-tools\21.1.1\dx.bat --dex --output E:\Android\AndroidStudio\WorkLocation\MyApplication\app\build\intermediates\pre-dexed\debug\classes-0f52de9bbc91bb9956813aaf2c6f0ff9d0160fa0.jar E:\Android\AndroidStudio\WorkLocation\MyApplication\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.2\classes.jar
Error Code: 1
Output: The system cannot find the path specified.
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: 24.154 secs
**Failed to complete Gradle execution
Cause:**
Does anyone know how to fix this?
I have an odd problem with AS. I have two OSX computers. A simple app builds on one of them but not the other. The two computers are almost identical.
Here are the specs of the two computers:
*OSX 10.8.5 - both fresh installed earlier this year. Not upgraded from older version of OSX.
*JDK 1.8.0_05
*Android Studio 0.8.1 - both fresh installed
*Latest Android SDK. The Android Studio SDK Manager looks exactly the same on both machines.
Here is how I build a test project:
Install fresh install of AS 0.8.0 for OSX
Upgrade to 0.8.1
Update SDKs
Start AS
Select New Project On "Configure your new project page", press Next button
On "Select form factors" page, press Next button
On "Add and activity" page, select Blank Activity and press Next button
On "Choose options" page, press Finish
Let AS build new project
Close Tip of the Day
Press Run button
As you can see, this is letting AS build the most basic template.
On one computer the build fails. On the other computer it succeeds and I can run the project in the emulator. On both computers I can Sync with Gradle and the Gradle build finishes.
On one computer, the build fails when click Run. I have compared the gradle.build files and, of course they are the same. They were both built by AS.
I am assuming something has been installed on the failing computer that prevents the build. How can I "reset" the failing computer? Would uninstalling JDK help? I have deleted AS many times and that does not help. I am not sure how to uninstall the various SDK components.
Here is the error messages I get when I Run on the failing computer:
Build fails with following output:
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild
:app:compileDebugNdk
:app:preDebugBuild
:app:checkDebugManifest
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava
:app:preDexDebug
:app:dexDebug
2014-07-07 21:30:45.482 java[19889:1603] Connection with distnoted server was invalidated
2014-07-07 21:30:45.542 java[19889:4103] Connection with distnoted server was invalidated
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Applications/Android Studio.app/sdk/build-tools/android-4.4W/dx --dex --num-threads=4 --output /Users/clark/AndroidStudioProjects/MyApplication/app/build/intermediates/dex/debug /Users/clark/AndroidStudioProjects/MyApplication/app/build/intermediates/classes/debug /Users/clark/AndroidStudioProjects/MyApplication/app/build/intermediates/dependency-cache/debug
Error Code:
1
Output:
2014-07-07 21:30:45.482 java[19889:1603] Connection with distnoted server was invalidated
2014-07-07 21:30:45.542 java[19889:4103] Connection with distnoted server was invalidated
Information:BUILD FAILED
Information:Total time: 1.514 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
Gradle Console shows following error:
Executing tasks: [:app:generateDebugSources]
Configuration on demand is an incubating feature.
:app:preBuild
:app:preDebugBuild
:app:checkDebugManifest
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
BUILD SUCCESSFUL
Total time: 4.441 secs
Executing tasks: [:app:assembleDebug]
Configuration on demand is an incubating feature.
:app:preBuild
:app:compileDebugNdk
:app:preDebugBuild
:app:checkDebugManifest
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava
:app:preDexDebug
:app:dexDebug
2014-07-07 21:30:45.482 java[19889:1603] Connection with distnoted server was invalidated
2014-07-07 21:30:45.542 java[19889:4103] Connection with distnoted server was invalidated
FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Applications/Android Studio.app/sdk/build-tools/android-4.4W/dx --dex --num-threads=4 --output /Users/clark/AndroidStudioProjects/MyApplication/app/build/intermediates/dex/debug /Users/clark/AndroidStudioProjects/MyApplication/app/build/intermediates/classes/debug /Users/clark/AndroidStudioProjects/MyApplication/app/build/intermediates/dependency-cache/debug
Error Code:
1
Output:
2014-07-07 21:30:45.482 java[19889:1603] Connection with distnoted server was invalidated
2014-07-07 21:30:45.542 java[19889:4103] Connection with distnoted server was invalidated
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: 1.514 secs