Skip to content

AAPT2 error during Android compilation #1094

@LeoDupont

Description

@LeoDupont

Please, provide the details below:

Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?

Yes

Tell us about the problem

I get the following error while running tns run android:

Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

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

Please provide the following version numbers that your issue occurs with:

  • CLI: 4.1.1
  • Cross-platform modules: 4.0.1
  • Runtime(s): 4.1.3

Did the error happen while the app was being constructed? (buildtime error)

Here is the log of tns run android --log trace:
log.txt

Please tell us how to recreate the issue in as much detail as possible.

  1. Install NativeScript on a Windows 10 computer with an account name containing non-ASCII characters (in my log, the "Ú" character in C:\Users\LÚo\... should be an "é" instead).
  2. Create a new project (even in a path without non-ASCII character) (in my case, it's the NativeScript with Angular Groceries tutorial).
  3. Run tns run android. At this point, it might or might not work a couple of times until it starts failing with the AAPT2 error and never works again (would it be with LiveSync or by re-running tns run android).

The only way I found to bypass this error is to set android.enableAapt2=false in platform/android/gradle.properties. However, if I run ./gradlew, it tells me this AAPT2 option is deprecated and will soon be removed:

PS C:\NativeScript\Groceries\platforms\android> ./gradlew
Starting a Gradle Daemon, 1 busy and 1 incompatible Daemons could not be reused, use --status for details

> Configure project :app
WARNING: 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..

As far as my research went, it seems that this problem could occur because of the non-ASCII character in my Windows user account (which can't be changed) and I am not the only one:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions