android - content not allowed in prolog - android

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?

Related

Error:Execution failed for task ':app:transformClassesWithInstantRunSlicerForDebug'. > java.io.IOException:

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.

Android Studio on Mac OS X, Gradle complaining about org.bouncycastle.asn1.ASN1Primitive

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

Error while building gradle in android studio

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library 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 FAILED
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\ProgramFiles\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1
This is the error i am getting every time i try to build the project in Studio. Tried all the possible solutions available in stackoverflow but not able to resolve , Please Help!!!!
Go to Build > Clean Project
then Build > Rebuild Project
if it doesn't work then go to File > Invalid Caches / Restart and select "Invalidate and Restart" button. it worked for me

Android studio does not start the application on the external device(application does not get installed)

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)

Android Studio Gradle :app:preDexDebug never finishes

I have an issue and despite of a lot of googling, i couldn't find any informations about it.
So I have Windows 7 and had Android Studio 1.1 RC Beta and after modifying my code regarding work with a database i got failure install_failed_dexopt
I tried to clean and then to rebuild my project and since that moment Gradle Executing Tasks never finishes if i run my project. I saw into the Gradle logs and here it is
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: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 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
I waited ~30 minutes and nothing after that.
If i try to stop it, it also never stops, i see only
Stopping - Gradle: Executing Tasks[:app:assembleDebug]
and nothing else
I tried to unistall Android Studio, installed also 1.0.1, I tried to run "hello world" application - is always the same. It would be great if someone have any idea about it, thank you!
So it seemed to be a problem with sdk. At first I didn't notice, that even if I install Android Studio and sdk into another folder path to sdk was always the same and it was something wrong with that sdk directorie.

Categories

Resources