jayatubi
jayatubi

Reputation: 2222

Aapt unknown command '--output-text-symbols'

I've just upgraded my Android environment to:

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..

Upvotes: 1

Views: 436

Answers (1)

jayatubi
jayatubi

Reputation: 2222

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.

Upvotes: 1

Related Questions