Android Studio Aapt2 error - java

I downloaded the 3.x version of android studio and got the error below.
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
 Then I tried the following method.
android.enableaapt2 = false
At the moment I get an error like this.
The option 'android.enableAapt2' is deprecated and should not be used
anymore. Use 'android.enableAapt2 = true' to remove this warning.
It will be removed at the end of 2018 ..
I tried a method like this.
android.enableaapt2 = true
At the moment I get an error like below. What do I have to do with you?
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

Related

Error after starting the empty activity in android

Please refer the error message given below.Every time I am starting an empty activity, I am getting the following error. This is my 6th time trying every possible solution out there.
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]
C:\Users\cheik\.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\396858f1c27f92ab2ca967b96e3a0da9\res\values-v28\values-v28.xml
Error:(9, 5) error: resource android:attr/dialogCornerRadius not found.
C:\Users\cheik\.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\396858f1c27f92ab2ca967b96e3a0da9\res\values\values.xml
Error:(1304, 5) error: resource android:attr/fontVariationSettings not found.
Error:(1304, 5) error: resource android:attr/ttcIndex not found.
C:\Users\cheik\OneDrive\Desktop\MYAPP\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml
Error:(11) error: resource android:attr/dialogCornerRadius not found.
Error:(7) resource android:attr/dialogCornerRadius not found.
Error:(11) resource android:attr/dialogCornerRadius not found.
C:\Users\cheik\OneDrive\Desktop\MYAPP\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Error:(514) resource android:attr/fontVariationSettings not found.
Error:(514) resource android:attr/ttcIndex not found.
Error:failed linking references.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Information:BUILD FAILED in 1s
Information:13 errors
Information:0 warnings
Information:See complete output in console
Experienced this issue a while ago with Android studio 3.5, have you tried to set:
compileSdkVersion 28 or compileSdkVersion 29 in my case, got to: app > build.gradle, this solved it for me.
you can also try to file > invalidate caches / restart
i noticed you're still on AppCompat 28 library, i suggest you migrate to AndroidX, Refactor > migrate to AndroidX

react native java.lang.RuntimeException: No server to serve request

I was just getting started with react native and I encountered some problem while building the app.
Here's the error:
(Complete log)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
AAPT err(Facade for 33021040): /home/srijan/Android/build-tools/27.0.3/aapt2: 1: /home/srijan/Android/build-tools/27.0.3/aapt2: Syntax error: "(" unexpected
Slave 33021040 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /home/srijan/Android/build-tools/27.0.3/aapt2) are not corrupted.
at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:193)
at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:250)
at java.lang.Thread.run(Thread.java:748)
AAPT err(Facade for 26937763): /home/srijan/Android/build-tools/27.0.3/aapt2: 1: /home/srijan/Android/build-tools/27.0.3/aapt2: Syntax error: "(" unexpected
Slave 26937763 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /home/srijan/Android/build-tools/27.0.3/aapt2) are not corrupted.
at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:193)
at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:250)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "queued-resource-processor_2" java.util.MissingFormatArgumentException: Format specifier '%1$s'
at java.util.Formatter.format(Formatter.java:2525)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.shouldDowngrade(AaptGradleFactory.java:156)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.error(AaptGradleFactory.java:122)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:253)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "queued-resource-processor_1"
java.util.MissingFormatArgumentException: Format specifier '%1$s'
at java.util.Formatter.format(Formatter.java:2525)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.shouldDowngrade(AaptGradleFactory.java:156)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.error(AaptGradleFactory.java:122)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:253)
at java.lang.Thread.run(Thread.java:748)
> Task :app:mergeDebugResources FAILED
Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
9 actionable tasks: 1 executed, 8 up-to-date
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
So this is the error
Kindly help me troubleshoot this thing.
Also I tried, re-downloading build-tools 27.0.3 with the sdkmanager cli.
You are trying to run the tools on linux 32 bit, but it is not supported. The supported systems are Windows (both 32 and 64 bit), Mac OS 64 bit and Linux 64 bit.
Here's more info one the Android Studio's page: https://developer.android.com/studio/#downloads
I recommend using https://expo.io, especially if you're just starting out.
It would also fix your resources' problem; you don't need an emulator, as you can test on your actual phone with hot reloading and all the good stuff.

How to solve AAPT2 error in android studio?

when I run my project with assembleDebug , I get this error
:app:mergeDebugResources
C:\Users\Deepan\Downloads\googleads-mobile-android-examples-
master\googleads-mobile-android-examples-master\java\admob\NativeAdvancedExample\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-sw600dp-v13\values-sw600dp-v13.xml: error: file not found.
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
I got the same problem and moving entire project to another location where the path is shorter solved it. You also have a quite long path.
File values-sw600dp-v13.xml
is missing from values-sw600dp-v13 folder.
past the file in values-sw600dp-v13 and it should work.

Aapt error Android Studio

I'm getting a Aapt error in all of my Android projects.
When searching for an solution I found using android.enableAapt2=false could help, but i'm constantly getting errors like;
Caused by: java.util.NoSuchElementException
at com.google.common.collect.AbstractIndexedListIterator.next(AbstractIndexedListIterator.java:80)
at com.google.common.collect.Iterators.getOnlyElement(Iterators.java:315)
at com.google.common.collect.Iterables.getOnlyElement(Iterables.java:263)
at com.android.builder.internal.aapt.v1.AaptV1.makePackageProcessBuilder(AaptV1.java:202)
at com.android.builder.internal.aapt.AbstractProcessExecutionAapt.makeValidatedPackage(AbstractProcessExecutionAapt.java:67)
at com.android.builder.internal.aapt.AbstractAapt.link(AbstractAapt.java:34)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:807)
... 56 more
I already reinstalled Android Studio, Android SDK and i tried deleting my settings files.
When i'm not using android.enableAapt2=false im getting
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
Caused by: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$compile$0(QueueableAapt2.java:136)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
... 1 more
Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:443)
at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:395)
at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:312)
at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)
I am using Android Studio 3.1.1 build 173.4697961.
edit: I also tried to clean the project, as well as running .gradlew clean, rebuild ect.
edit: I'm using Gradle 4.4 and Android Studio 3.1.1. I cleared the cache and restarted, also I deleted the .gradle/cache folder from my account
I was getting same error, here's steps i followed to resolve it.
-update all files in app.gradle its asking for.
- update all files in build. gradle its asking for.
- invalidate cache and restart Android studio.
Aapt2 is enabled by default when you use android plugin for gradle 3.0.
so open gradle.properties and add android.enableAapt2=false
as shown here https://i.stack.imgur.com/lWyT2.png
I fixed it by reinstalling my PC.
The problem was caused by having ë in my username.
this can happen if you edited String.xml file. reset Strings.xml
I guess by invalidating cache and restarting may fix your problem!

Error:Execution failed for task ':app:mergeDebugResources'. > Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException:

Above error along with these errors and cannot resolve R symbol error.
Error:java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request.
Check logs for details.
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request.
Check logs for details.
I tried all solutions given like rebuild,invalidate caches and restart, changed dependencies as well and clean project did not used any images. I installed android studio 3.0.1 in ubuntu 14.04 OS type 32-bit
Is this a installed android stdio version mistake please help me out.

Categories

Resources