1

I've just upgraded my Android environment to:

  • macOS 10.13.5
  • Andorid Studio 3.1.4
  • gradle 4.6
  • gradle plugin 'com.android.tools.build:gradle:3.1.4'
  • Android SDK 28
  • Build tool 28.0.2

However, when I was going to build my project it always fails at the task processXXXDebugResources with such error:

AAPT err(Facade for 111853366) : No Delegate set : lost message:error: unknown command '--output-text-symbols'.
AAPT err(Facade for 111853366) : No Delegate set : lost message:Error
Failed to execute aapt

I have no idea where does the --output-text-symbols come from. It looks like the --output-text-symbols was a parameter for the program aapt but the latest gradle plugin uses another new aapt2.

The android.enableAapt2=false could make this issue disappear but a warning tells this option will be deprecated.

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..
jayatubi
  • 1,972
  • 1
  • 21
  • 51

1 Answers1

1

I found a solution.

In my build.gradle there was an aaptOptions with a zero length string parameter:

aaptOptions {
    noCompress ""  // <- zero length string
}

It used to work on the 2.x gradle plugin, but failed on the latest 3.x version. It looks like the new plugin provided incorrect arguments for aapt command.

My suspicion:

In the old version the arguments might be:

aapt -0 '' --output-text-symbols
        ^
this is the zero-length string from aaptOptions in bulid.gradle

But in the latest version this becomes to:

aapt -0 --output-text-symbols
        ^
something is missing

And then I tried to use a one char length space string:

aaptOptions {
    noCompress " "  // <- one char length space string
}

I guess the arguments now become to:

aapt -0 ' ' --output-text-symbols
         ^
  the space comes back

Then it fix the problem for me.

jayatubi
  • 1,972
  • 1
  • 21
  • 51
  • You are exactly right, we've encountered this before and the support for this is added in 3.2 canaries. Good job figuring this out by yourself! – Izabela Orlowska Sep 04 '18 at 14:41