Reputation: 13
this is my first time asking here
I'm using android studio 3.2 Whenever i create a new project or open an old one i get this error in build:
E:\AndroidProjects\app\src\main\res\values\colors.xml:1:1: Error: Content is not allowed in prolog.
and when i open the colors.xml file it contains the following comment
/** Copyright (C) 2011 The Android Open Source Project** Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may ob
when I tried to change this comment to the usual colors.xml content which is :
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
i had this error
Android resource compilation failed Output: E:\AndroidProjects\app\src\main\res\mipmap-anydpi-v26\ic_launcher.xml:1: error: not well-formed (invalid token).
Command: C:\Users\New Tech.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\b01082f257a5a2a15bea752c6346e430\aapt2-3.2.0-4818971-windows\aapt2.exe compile --legacy \ -o \ E:\AndroidProjects\app\build\intermediates\res\merged\debug \ E:\AndroidProjects\app\src\main\res\mipmap-anydpi-v26\ic_launcher.xml Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #2
and sometimes i get a message that an idea error occurred when i open it i shows the following
Failed to build java cls class for C:/Users/New Tech/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.0/a134b0cfe9bb44f98b0b3e889cda07923eea9428/kotlin-stdlib-1.3.0.jar!/kotlin/UnsignedKt.class: C:/Users/New Tech/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.0/a134b0cfe9bb44f98b0b3e889cda07923eea9428/kotlin-stdlib-1.3.0.jar!/kotlin/UnsignedKt.class: null
Are these issues related?
Note:I didn't change anything from my prior settings or anything
I searched a lot before asking here and found nothing related to my problem because I didn't know how to phrase he question
And this is he build.gradle for the app (this app is an example that contains nothing yet)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Upvotes: 1
Views: 2331
Reputation: 1
I faced the same problem. I tried a few solutions but nothing worked. Then I tried to start a new project with Basic Activity instead of Empty Activity, and it worked. No errors and it ran fine, not sure why, but it does fix the problem, for me.
Upvotes: 0
Reputation: 7531
Sounds like you've hit a known issue that has affected a lot of people on Windows. It happens if your system is shutdown suddenly or Android Studio is killed. The team is aware of this issue and is working on identifying the cause.
You can follow the progress on https://issuetracker.google.com/119638289
Upvotes: 0