Android project unable to build on update to android studio 3.2 - android

its showing on build console:
Android resource compilation failed
Output: C:\Users\User\AndroidStudioProjects\Booklify\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1434: error: inner element must either be a resource reference or empty.
Command: C:\Users\User.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\fc444429c9ac9f1db8d9bb3790bf9413\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\User\AndroidStudioProjects\Booklify\app\build\intermediates\res\merged\debug \
C:\Users\User\AndroidStudioProjects\Booklify\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #2

Please write this command on terminal of your project in android studio.
gradlew clean

I recently had a similar issue. Please have a look into your values.xml at the given line. There will most likely be some id like
<item name="abc" type="id"/> which has not /> but a value like <item name="abc" type="id">abc</item>
This wasn't allowed since the beginning but now it also causes a compilation error. So remove the value and the closing tag and add the slash before the >
Edit: Of course you need to do this change in the ids.xml (or any other related file) not in the values.xml inside the build folder. But this file gives you the hint where to look.

Related

I'm stuck in gradle errors for days. I've no idea how to fix this. I can't find the solution anywhere in the internet

Whenever I'm trying to sync the files of my app to the gradle files it shows the following error. I can't figure out the solution and I'm stuck here for days.
Android resource compilation failed
Output: C:\Users\KIIT\AndroidStudioProjects\QuestionMe2\app\src\main\res\layout\activity_main.xml:2: error: XML or text declaration not at start of entity.
Command: C:\Users\KIIT\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\38553b6ae651a252892876ddc663dbcd\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\KIIT\AndroidStudioProjects\QuestionMe2\app\build\intermediates\res\merged\debug \
C:\Users\KIIT\AndroidStudioProjects\QuestionMe2\app\src\main\res\layout\activity_main.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #2
I've no idea what this says. Please help me.
Move this line of code at your activity_main.xml to the first line!
<?xml version="1.0" encoding="utf-8"?>

I am getting the following errors in Android Studio “Android resource compilation failed”

Android resource compilation failed
Output: C:\Users\Christain Sheridan\Downloads\Crisis-Response\Crisis-
Response\app\src\main\res\layout\crisis_menu.xml:95: error: not well-formed (invalid token).
Command: C:\Users\Christain Sheridan\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\daf4756f8943226640d70255bc14ccd5\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\Christain Sheridan\Downloads\Crisis-Response\Crisis-Response\app\build\intermediates\res\merged\debug \
C:\Users\Christain Sheridan\Downloads\Crisis-Response\Crisis-Response\app\src\main\res\layout\crisis_menu.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #1
Update: I fixed it myself, it seems that when I use a git pull from my master it puts HEAD>>>>>>> and more stuff that looks like a commit stuff that somehow got in there. But once I removed all of them it worked so never mind.
it reads crisis_menu.xml:95: error: not well-formed (invalid token)
so you probably should check crisis_menu.xml at line 95.
and maybe use fetch & rebase instead of pull.

Can't compile files that don't belong to my project

I Replaced one attribute of all of my .xml files by a mistake. so I undo all of them . now Android failed to compile the project because of internal files that does not belong to my project . look at this Error for example:
Android resource compilation failed
Output: C:\Users\andrew\.gradle\caches\transforms-1\files-1.1\support-
compat-28.0.0.aar\0f40d142e6b58b7fe15914d4ec5e3dc5\res\layout\notification_action.xml:24: error: duplicate attribute.
Command: C:\Users\andrew\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\cacb99a92dc25d61ade7acbb3a469d02\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\andrew\AndroidStudioProjects\clone\app\build\intermediates\res\merged\debug \
C:\Users\andrew\.gradle\caches\transforms-1\files-1.1\support-compat-28.0.0.aar\0f40d142e6b58b7fe15914d4ec5e3dc5\res\layout\notification_action.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #3
this happened for many .xml in internal files .
my IDE is Android Studio 3.2.1
This happened to me .Delete this file C:\Users\andrew.gradle\caches\transforms-1 form windows and build your project. this should solve your problem .

Android Hello World Project Error: "Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #2"

2018/09/27
I upgraded android studio to 3.2.0 and created the default project.
But the compiler shows the error:
Android resource compilation failed
Output: C:\Users\DELL-BODETY\AndroidStudioProjects\MyApplication3\app\src\main\res\drawable\ic_launcher_background.xml:1: error: not well-formed (invalid token).
Command: C:\Users\DELL-BODETY\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\1135036532c8b3c53c96f89a2a22aaca\aapt2-3.2.0-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\DELL-BODETY\AndroidStudioProjects\MyApplication3\app\build\intermediates\res\merged\debug \
C:\Users\DELL-BODETY\AndroidStudioProjects\MyApplication3\app\src\main\res\drawable\ic_launcher_background.xml
Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #1
And I can't think of any way out.Just for help!!
app\src\main\res\drawable\ic_launcher_background.xml:1: error: not
well-formed (invalid token).
Go to drawable directory and find this file: ic_launcher_background.xml.
It seems like there is a compilation error, spelling mistake, not well typed or etc. You need to check which one is. It should show an error or something with red line error. Probably, used semicolon or something similar.

How to use Javah in Ubuntu14.04 for HelloNDK?

I am using Ubuntu14.04, Eclipse Luna.
I am referring Hello World Example given link
http://www.ntu.edu.sg/home/ehchua/programming/android/Android_NDK.html
My project name is HelloNDK.
My project path is /home/androiddev/workspace_luna/HelloNDK
In AndroidManifest.xml
I can see package which I use is named as: com.delta.hellondk
Android.jar which automatically added in project which is under Android 5.0.1 & its location shown as
/home/androiddev/Applications/Android_sdk/sdk/platforms/android-21/android.jar
When I use javah command, I got error.
I use following line in terminal.
javah -jni -classpath /home/androiddev/workspace_luna/HelloNDK/bin/classes/;/home/androiddev/Applications/Android_sdk/sdk/platforms/android-21/android.jar -o HelloJNI.h com.delta.hellondk
&
javah -jni -classpath /home/androiddev/workspace_luna/HelloNDK/bin/classes/JNIActivity.class;/home/androiddev/Applications/Android_sdk/sdk/platforms/android-21/android.jar -o HelloJNI.h com.delta.hellondk
when I use following command, I got error as follows:
Error: No classes were specified on the command line. Try -help.
bash: /home/androiddev/Applications/Android_sdk/sdk/platforms/android-21/android.jar: cannot execute binary file: Exec format error
Now I search lots of keywords in google, stackoverflow regarding how to generate HelloJNI.h automatically.
But i failed.
Please guide me!
I know its repeate question should be get negative vote, should be 'On Hold'. But then also i doesn’t get any clue so i asked without hesitate.

Categories

Resources