Android Studio loading issue - android

How to solve this issue .
Load setting Cannot load settings from file
'C:\Users\sujeet14108\AndroidStudioProjects\Rough.idea\gradle.xml':
Error on line 1: Content is not allowed in prolog.
Please correct the file content

The problem is occurring because of gradle.xml inside App/build directory of your project.
Try this way
Clean your project using Build > Clean Project
Close your Android Studio now
Go to the project directory and delete the gradle.xml file
Open Android Studio again and let it sync the project with gradle .
Android studio compile error "Content is not allowed in prolog"

Related

Android Studio: Unable to build app due to gradle distribution url error

I know this question has been asked before but I haven't been able to fix the issue. I am running Android Studio version 3.1.4. I am trying to run an app that I cloned from a Github repository. But even before I try to run it, I get this error:
my-app: sync failed
Cause: https://downloads.gradle.org/distributions-snapshots/gradle-4.4-20171031235950+0000-all.zip
How do I fix this error? Thanks in advance.
You can check and change the distribution url in the properties file $rootDir/gradle/wrapper/gradle-wrapper.properties. See property distributionUrl.
Value should be something as follows (update the gradle version depending on your Android Studio version)
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
I've encountered a similar error when I tried importing the Sunshine project from the Udacity Android development course. I fixed the issue by downloading the mentioned zip file and extracted it to the C:\Users\<username>\.gradle\native folder.
Then in Gradle settings, use local Gradle distribution and set the Gradle home path to the downloaded gradle folder.
Check this video for more information
You can fix it by the following steps: (currently using Android 3.6.3)
This worked for me.
Exit android studio then make the below changes.
Go to C:\Users\UserName.android and rename the build-cache folder to build-cache.bak.
Go to C:\Users\UserName.AndroidStudio3.6\system and rename these folders:
caches to caches.bak
compiler to compiler.bak
compile-server to compile-server.bak
conversion to conversion.bak
external_build_system to external_build_system.bak
frameworks to frameworks.bak
gradle to gradle.bak
resource_folder_cache to resource_folder_cache.bak
Open the Android Studio and open your project again.
If the folder is not in the Android3.6 folder, move to the next step.
Find the Gradle version from the gradle-wrapper.properties file
Download the Gradle bin file from internet, then extract it.
File menu-->Settings-->Build & Tools-->Gradle-->Use Gradle from: From
drop down select a specified location and browse to the location
where you have saved the Gradle bin zip file. (Default settings is use from ;gradle-wrapper.properties' file)
4.File menu-->Invalidate caches and re-run
[Gradle properties file]
[Gradle settings]

How to solve Specified AAPT2 executable does not exist on Android Studio 3.2

I've an issue with Android Studio. I'm trying to use it on Windows but I've trouble during the project's build process.
First, notice Android Studio is installed on my secondary HDD.
When I try to build/run my project I get this error:
Specified AAPT2 executable does not exist:
C:\Users\Rémi\\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\35960bdffa2420a45dff6ec260c07fa9\aapt2-3.2.0-4818971-windows\aapt2.exe
And indeed there is no aapt2.exe here.
But I've found this .exe here:
H:\Logiciels\AndroidStudioSDK\build-tools\28.0.2\aapt2.exe
and a previous version here:
H:\Logiciels\AndroidStudioSDK\build-tools\27.0.3\aapt2.exe
I've tried to fix this issue by changing the build tools version by setting File > Project structure > Modules > App > Build Tools Version. This option was empty and I chose 28.0.2 but that doesn't change anything.
Thanks for reading.
P.S.: This question is not the same. My error is different and I have google() in my Grable file.
I solved it by deleting the directory under which it expected the aapt2 executable, e.g. C:\Users\support\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\4c1f5b7dca1d5d378360be7f3fd9726a\aapt2-3.2.1-4818971-windows and then did a clean in Android Studio Build>Clean Project.
Afterwards it appears to have downloaded this again, with the missing executable, and now works perfectly.
I had the same issue. I resolved it by opening my file browser and navigating to this folder
C:\Users\(My User Name)\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar
Opening this folder and viewing its contents, I deleted the folder labeled 81c3666e327fa931c773a52e6cb0b3b7 which for you would be 35960bdffa2420a45dff6ec260c07fa9.
After this I went back to Android Studio and clicked the Build menu, and used the Clean Project option, followed by the Rebuild Project option.
I no longer get this error, or all the debug errors that say the Java package "R" did not exist.
I hope this helps.
Following solved my issue
under jar folder there are 3 folders, one of the folder consists of the aapt2.exe in it.
I copied that file to other folder where I am getting error.
ex:
path of jar: C:\Users\umabhavania\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar
error path: C:\Users\umabhavania\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\a57a698502c21bfe8cfc3ed6eb102b39\aapt2-3.2.1-4818971-windows
copied aapt2.exe file from 57f15fb82085ec9389484ff7e041344f folder to a57a698502c21bfe8cfc3ed6eb102b39
Hope this helps..
I resolved this issue by removing that folder
Go to that path -> Delete
Ex: C:\Users\Rémi.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\35960bdffa2420a45dff6ec260c07fa9\aapt2-3.2.0-4818971-windows\aapt2.exe
In this go to "C:\Users\Rémi.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\" and delete 35960bdffa2420a45dff6ec260c07fa9
Clean Project and Build
1- enter to the file like
C:\Users\4khalil\.gradle\caches\transforms-1\files-1.1\aapt2-3.3.2-5309881-windows.jar\6abc6a09978228d11497e7ca9c3de2c9\aapt2-3.3.2-5309881-windows
then if you find aapt2.exe.dat, delete the extension .dat to be aapt2.exe
and the problem will be solved.
You can use 'invalidate cache and restart'.
In Android Studio, go to File menu -> click Invalidate Caches/Restart.
Just chnage the gradle version in your build.gradle file in android folder.
For example mine was 4.1.0, changed it to 4.1.1
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
just copy paste this file aap2.exe get it from a friend or somewhere at this location and paste it on the same folder found in yours in .gradle C:\Users\Dina.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\8735df2342ae4ae127451389faa5e1f1\aapt2-3.2.1-4818971-windows\
then build and then the build will complete successful.
I didn't know how to attach the file in my answer I am new to stack overflow.

Why the following error is showing while importing an project?

Why the following error is showing in android studio while importing a external project (https://github.com/udacity/ud839_Miwok/tree/Starter-code)?
Error: Gradle 'ud839_Miwok-Starter-code' project refresh failed
Error:Content is not allowed in prolog.
Try to clean and to rebuild your project. This is located at the Build Menu.
If this does not help, please show more details like your project tree, especially your resource diretory. It may also be that you created something at a place where it is not allowed to be.

Android Studio renaming

I recently renamed my Android app project in Android Studio (1.1b4) project, but am now unable to rebuild. I get this error:
Error:Execution failed for task ':app:clean'.
> Unable to delete directory: D:\AndroidstudioProjects\PcUpload\app\build\intermediates\res\release\values-sw600dp-v13
I renamed by right-clicking the top-level in the Project hierarchy, then selecting "Refactor...Rename".
Can anyone advise how I can remedy this?
Please make sure to rename project using refactor. You are getting that error because that project technically doesnt exsist under that directory, due to rename.
Another solution would be
Close android studio
Change project root directory name
Open android studio
Open the project(not from local history but by browsing to it)
Or follow This youtube video!
Or this!

Android Studio Error - Unable to open PNG file

I am getting the error that is pictured above when I try to build my project in Android Studio.
The file that is mentioned in the error does not exist in that folder. I tried to delete the entire folder hoping it would re-download the needed file. It did re-download the folder but again it did not have that file.
I am not using this file anywhere in my project and as far as I know.
Any help would be greatly appreciated.
Thanks.
Maybe the path of file is too long that it is unable to process it. In my case, it was:
C:\Users\ber$erk-kAjU\Downloads\Compressed\android-xmpp-asmack-sample-master\android-xmpp-asmack-sample-master\XMPPAsmackSample\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.3\res\drawable-ldrtl-xxhdp
As you can see, it is huge! I just moved my project to another path, and reduced it to:
D:\AndroidStudioWorkspace\XMPPAsmackSample\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.3\res\drawable-ldrtl-xxhdp
Maybe this can help!
Use
Build > Clean Project
To clean the build directory.
I think you are using AppCompat library in your build.gradle file
dependencies {
compile 'com.android.support:appcompat-v7:+'
}
In order to use any support library in dependency make sure you have downloaded Android Support Repository from SDK manager
After downloading the repository, do sync the project with gradle using tiny gradle button available in toolbar.
After sync completion you will be able to see mentioned png file in directory as shown :
Inside the directory.
EDIT :
If still doesn't solve check the whether your sdk pointing to right sdk from File > Project Structure > Android SDK
Also check this Import Google Play Services library in Android Studio for AppCompat Library
If there is some issue make it correct ans sync project with gradle.

Categories

Resources