whenever I try to run my app i get this error :
Error:Execution failed for task
:app:transformClassesWithInstantRunSlicerForDebug'.
java.io.IOException: Failed to delete
C:\Users\ashis\AndroidStudioProjects\FirstApp\app\build\intermediates\instant-run-support\debug\restart-changes.txt**
and here is the output:
Information:Gradle tasks
[:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders 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:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:buildInfoDebugLoader
:app:transformClassesWithExtractJarsForDebug UP-TO-DATE
:app:transformClassesWithInstantRunVerifierForDebug UP-TO-DATE
:app:transformClassesWithJavaResourcesVerifierForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug UP-TO-DATE
:app:transformClassesWithInstantRunForDebug UP-TO-DATE
:app:transformClasses_enhancedWithInstant+reloadDexForDebug UP-TO-DATE
:app:incrementalDebugTasks
:app:prePackageMarkerForDebug
:app:fastDeployDebugExtractor UP-TO-DATE
:app:generateDebugInstantRunAppInfo UP-TO-DATE
:app:coldswapKickerDebug
:app:transformClassesWithInstantRunSlicerForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithInstantRunSlicerForDebug'.
java.io.IOException: Failed to delete C:\Users\ashis\AndroidStudioProjects\FirstApp\app\build\intermediates\instant-run-support\debug\restart-changes.txt
Information:BUILD FAILED
Information:Total time: 1 mins 6.761 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
:app:transformClassesWithInstantRunSlicerForDebug'.
java.io.IOException: Failed to delete
-- try to clean project and rebuild project.
From #Kael: A clean is performed via Build -> Clean Project or Build -> Rebuild Project.
Kindly follow these steps:
Goto
1>File
2>Settings
3>Build,Execution,Deployment
4>Instant Run
5>Uncheck (Enable Instant Run to hot swap code)
So this helped me.
In my situation Build Menu > Clean Project and Build Menu > Rebuild did NOT work. Instead I had to delete the build folder manually from the filesystem (using Finder on OSX, Explorer on Win).
Try to clean project and rebuild project from Build Menu > Clean Project and Build Menu > Rebuild
try restarting android studio or use android studio on different user
I had the same problem .. I solved my problem by deleting .gradle file on my project root and rebuilt my project again.
I had Execution failed for task ':app:generateDebugBuildConfig'. error, cleaning and rebuilding project was not working.
I added C:\Users\...\AppData\Local\Android\sdk\tools to my PATH Environment variable.
I closed android studio and vscode that I was using for edit project files. (This is very important)
I run the project and it worked fine.
Change this https://services.gradle.org/distributions/gradle-4.4-all.zip to this https://services.gradle.org/distributions/gradle-4.1-all.zip in grable-wrapper.prperties. And then re import the properties. and sync the project.
Recently migrated (or still trying to) from Eclipse ADT to Android Studio, here's what Gradle says when I hit `Run' (full trace below):
* What went wrong:
Execution failed for task ':app:packageDebug'.
> class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z
I've seen: Android Studio Bouncy castle issue (newbie), Problems launching error in Android Studio when packageDebug at Max OS X and similar SO posts that all point out to a bouncy castle JAR (bcprov-jdk15on-1.48.jar) that should be removed from the classpath. However I have no such JAR file there and it, in fact, Gradle itself seems to download it because the only place where I found it was:
/Applications/Android Studio.app/Contents/gradle/m2repository/org/bouncycastle/bcprov-jdk15on/
Trying to delete the file there, Gradle complains that a referenced library is missing.
Just how do I fix this?
Complete trace:
Executing tasks: [:app:assembleDebug]
Configuration on demand is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library 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:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithJarMergingForDebug UP-TO-DATE
:app:collectDebugMultiDexComponents
:app:transformClassesWithMultidexlistForDebug UP-TO-DATE
:app:transformClassesWithDexForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageDebug'.
> class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z
* 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: 0.479 secs
i've just installed the latest version of Android Studio Bundle with SDK
but i couldn't run even its "hello world" default simple program and when ever i tried to run program it just keep saying Execution failed for task ':app:preDexDebug'.
and here is the complete gradle console log:
Executing tasks: [:app:assembleDebug]
Configuration on demand is an incubating feature. :app:preBuild
UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72211Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42211Library 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:processDebugJavaRes UP-TO-DATE :app:compileDebugJava
UP-TO-DATE :app:compileDebugNdk UP-TO-DATE :app:compileDebugSources
UP-TO-DATE :app:preDexDebug FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:preDexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command
'C:\Program Files\Java\jdk1.8.0_40\bin\java.exe'' finished with
non-zero exit value 1
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: 4.734 secs
i tried with jdk version 7 and jdk 8 (32bit-win8)
i know there are similar topic and questions but none of them counldn't solve my problem
I am trying android studio for the first time.
I have connected external android device via USB (debugging device settings are done in android device). I click on run button with selection as USB device.
The Run console shows this
Waiting for device.
Target device: iball-3g_q1035-0123456789ABCDEF
Whereas my gradle console shows this
Executing tasks: [:app:assembleDebug]
Configuration on demand is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72200Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42200Library 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 UP-TO-DATE
:app:dexDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug UP-TO-DATE
:app:zipalignDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
BUILD SUCCESSFUL
Total time: 1.292 secs
But my application does not start on the device. Can somebody please let me know where i am doing mistake?(ps : application works perfectly on the eclipse)
After 2 hours of unsuccessfully searching for solution I've decided to ask a question here.
I've downloaded a project from a git repository which used to work in August. Android Studio made me update classpath and buildToolsVersion in build.gradle files. After doing this I'm getting an error of app:mergeDebugResources failed.
:app:preBuild
:app:preDebugBuild
:app:checkDebugManifest
:ScavengerHunt-endpoints:compileLint
:ScavengerHunt-endpoints:copyReleaseLint UP-TO-DATE
:ScavengerHunt-endpoints:preBuild
:ScavengerHunt-endpoints:preReleaseBuild
:ScavengerHunt-endpoints:checkReleaseManifest
:ScavengerHunt-endpoints:preDebugBuild
:ScavengerHunt-endpoints:preDebugTestBuild
:ScavengerHunt-endpoints:prepareComAndroidSupportSupportV42000Library
:ScavengerHunt-endpoints:prepareComGoogleAndroidGmsPlayServices6171Library
:ScavengerHunt-endpoints:prepareReleaseDependencies
:ScavengerHunt-endpoints:compileReleaseAidl
:ScavengerHunt-endpoints:compileReleaseRenderscript UP-TO-DATE
:ScavengerHunt-endpoints:generateReleaseBuildConfig UP-TO-DATE
:ScavengerHunt-endpoints:generateReleaseAssets UP-TO-DATE
:ScavengerHunt-endpoints:mergeReleaseAssets UP-TO-DATE
:ScavengerHunt-endpoints:generateReleaseResValues UP-TO-DATE
:ScavengerHunt-endpoints:generateReleaseResources UP-TO-DATE
:ScavengerHunt-endpoints:mergeReleaseResources
:ScavengerHunt-endpoints:processReleaseManifest UP-TO-DATE
:ScavengerHunt-endpoints:processReleaseResources
:ScavengerHunt-endpoints:generateReleaseSources
:ScavengerHunt-endpoints:compileReleaseJava
:ScavengerHunt-endpoints:extractReleaseAnnotations
:ScavengerHunt-endpoints:mergeReleaseProguardFiles UP-TO-DATE
:ScavengerHunt-endpoints:processReleaseJavaRes UP-TO-DATE
:ScavengerHunt-endpoints:packageReleaseJar UP-TO-DATE
:ScavengerHunt-endpoints:compileReleaseNdk UP-TO-DATE
:ScavengerHunt-endpoints:packageReleaseJniLibs UP-TO-DATE
:ScavengerHunt-endpoints:packageReleaseLocalJar UP-TO-DATE
:ScavengerHunt-endpoints:packageReleaseRenderscript UP-TO-DATE
:ScavengerHunt-endpoints:packageReleaseResources UP-TO-DATE
:ScavengerHunt-endpoints:bundleRelease UP-TO-DATE
:app:preReleaseBuild
:app:prepareComAndroidSupportSupportV42100Library
:app:prepareComGoogleAndroidGmsPlayServices6171Library
:app:prepareScavenegetHuntScavengerHuntEndpointsUnspecifiedLibrary
:app:prepareDebugDependencies
:app:compileDebugAidl
: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
[Fatal Error] :1:1: Content is not allowed in prolog.
D:\scaveneget-hunt\app\src\main\res\protobuf\protocol.proto:0:0: Error: Content is not allowed in prolog.
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> D:\scaveneget-hunt\app\src\main\res\protobuf\protocol.proto:0:0: Error: Content is not allowed in prolog.
I've tried to delete .idea also opened this file in hexeditor but there's nothing at 0:0. Let me know if I should include more info.
--UPDATE--
If I delete everything from .proto file it fails because of "premature end of file" which seems OK. If I write the code below the error message is "content is not allowed" again.
message Im{
required string text = 1;
}
Am I missing something in Android Studio's settings?