2

I'm attempting to create Java sources for the R class using aapt2, however it results in errors that I'm having trouble working out how to resolve. The library in question is the androidx appcompat library, specifically version 1.0.2.

My steps are:

Extract the .aar to its own folder. In this case: C:\Temp\appcompat-1.0.2

Execute aapt2 compile:

"C:\Android\SDK\build-tools\31.0.0\aapt2.exe" compile --dir "C:\Temp\appcompat-1.0.2\res" -o "C:\Temp\compiled_res.flata"

Execute aapt2 link:

"C:\Android\SDK\build-tools\31.0.0\aapt2.exe" link --auto-add-overlay -I "C:\Android\SDK\platforms\android-31\android.jar" --manifest "C:\Temp\appcompat-1.0.2\AndroidManifest.xml" -R "C:\Temp\compiled_res.flata" -o "C:\Temp\linked_res.ap_" --java "C:\Temp\src"

This results in:

C:\Temp\appcompat.1.0.2\res\color\abc_btn_colored_borderless_text_material.xml:20: error: attribute alpha (aka androidx.appcompat:alpha) not found.
C:\Temp\appcompat.1.0.2\res\color\abc_btn_colored_text_material.xml:20: error: attribute alpha (aka androidx.appcompat:alpha) not found.
C:\Temp\appcompat.1.0.2\res\color\abc_tint_btn_checkable.xml:19: error: attribute alpha (aka androidx.appcompat:alpha) not found.
C:\Temp\appcompat.1.0.2\res\color\abc_tint_default.xml:19: error: attribute alpha (aka androidx.appcompat:alpha) not found.
C:\Temp\appcompat.1.0.2\res\color\abc_tint_edittext.xml:19: error: attribute alpha (aka androidx.appcompat:alpha) not found.
C:\Temp\appcompat.1.0.2\res\color\abc_tint_seek_thumb.xml:19: error: attribute alpha (aka androidx.appcompat:alpha) not found.
C:\Temp\appcompat.1.0.2\res\color\abc_tint_spinner.xml:19: error: attribute alpha (aka androidx.appcompat:alpha) not found.
C:\Temp\appcompat.1.0.2\res\color\abc_tint_switch_track.xml:19: error: attribute alpha (aka androidx.appcompat:alpha) not found.
C:\Temp\appcompat.1.0.2\res\color\abc_tint_switch_track.xml:20: error: attribute alpha (aka androidx.appcompat:alpha) not found.
C:\Temp\appcompat.1.0.2\res\color\abc_tint_switch_track.xml:21: error: attribute alpha (aka androidx.appcompat:alpha) not found.
error: failed linking file resources.

I assume that there's something I'm missing?

Dave Nottage
  • 3,411
  • 1
  • 20
  • 57

0 Answers0