Android app from Fire doesn't work with AppCompatActivity

Nope. if I link each car separately, then linking “just” the projects own resources fails with

E:                   aapt2 link: attribute autoFocusButtonColor (aka inprax.pl.testapp:autoFocusButtonColor) not found. [/Users/mh/Downloads/inprax.pl.testapp/inprax.pl.testapp/res/layout/main.xml (23)]
E:                   aapt2 link: attribute autoFocusButtonVisible (aka inprax.pl.testapp:autoFocusButtonVisible) not found. [/Users/mh/Downloads/inprax.pl.testapp/inprax.pl.testapp/res/layout/main.xml (23)]
E:                   aapt2 link: attribute flashButtonColor (aka inprax.pl.testapp:flashButtonColor) not found. [/Users/mh/Downloads/inprax.pl.testapp/inprax.pl.testapp/res/layout/main.xml (23)]
E:                   aapt2 link: attribute flashButtonVisible (aka inprax.pl.testapp:flashButtonVisible) not found. [/Users/mh/Downloads/inprax.pl.testapp/inprax.pl.testapp/res/layout/main.xml (23)]
E:                   aapt2 link: attribute frameAspectRatioHeight (aka inprax.pl.testapp:frameAspectRatioHeight) not found. [/Users/mh/Downloads/inprax.pl.testapp/inprax.pl.testapp/res/layout/main.xml (23)]
E:                   aapt2 link: attribute frameAspectRatioWidth (aka inprax.pl.testapp:frameAspectRatioWidth) not found. [/Users/mh/Downloads/inprax.pl.testapp/inprax.pl.testapp/res/layout/main.xml (23)]
E:                   aapt2 link: attribute frameColor (aka inprax.pl.testapp:frameColor) not found. [/Users/mh/Downloads/inprax.pl.testapp/inprax.pl.testapp/res/layout/main.xml (23)]
E:                   aapt2 link: attribute frameCornersRadius (aka inprax.pl.testapp:frameCornersRadius) not found. [/Users/mh/Downloads/inprax.pl.testapp/inprax.pl.testapp/res/layout/main.xml (23)]
E:                   aapt2 link: attribute frameCornersSize (aka inprax.pl.testapp:frameCornersSize) not found. [/Users/mh/Downloads/inprax.pl.testapp/inprax.pl.testapp/res/layout/main.xml (23)]
E:                   aapt2 link: attribute frameSize (aka inprax.pl.testapp:frameSize) not found. [/Users/mh/Downloads/inprax.pl.testapp/inprax.pl.testapp/res/layout/main.xml (23)]
E:                   aapt2 link: attribute frameThickness (aka inprax.pl.testapp:frameThickness) not found. [/Users/mh/Downloads/inprax.pl.testapp/inprax.pl.testapp/res/layout/main.xml (23)]
E:                   aapt2 link: attribute maskColor (aka inprax.pl.testapp:maskColor) not found. [/Users/mh/Downloads/inprax.pl.testapp/inprax.pl.testapp/res/layout/main.xml (23)]
E:                   aapt2 link: failed linking file resources.
                  <- Task ProcessAndroidResources failed for inprax.pl.testapp, Cooper-Android, took 0.2723s (0.272s).

:frowning:

I guess what I could do is (a) link each .aar separately just to get the R.java.But then link everything in one go again for the actual app. Seems redundant, but worth a try…

So how this simple solution works. From commandline in bacol url l gave you…i dont know everything about what is going “under…”

I’ll commit a fix now, but I need run out soon. Hopefully this should have all resources and the tight R classes…

Did you run this app, dont forget that build works…?

No. I’m not set up to run anything, right now.

The bigger test app (and one real app) still fail with several errors about missing “alpha”. But that’s an issue for another day.

E:                   aapt2 link: attribute alpha (aka androidx.appcompat:alpha) not found. [/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/Weather for Android-0602CFB8260D6296BF360A93C81275CD7AB91075/Release/Cooper-Android/aar/appcompat-1.6.1/res/color/abc_tint_btn_checkable.xml (19)]

Should i try to run codescanner with your fix?

Please.

lovely:

  • " Remove attr: android:alpha=“?android:disabledAlpha”"
  • “How do i remove attr: android:alpha=”?android:disabledAlpha"? Its part of the external library and I am unable to change it!"
  • “Immigrate to AndroidX then”

thats a LOT of words for “this toolchain is just FUCKED UP behind repair”…

Still the question is how did it work with aapt… I hate this too… For me library is lubrary and should work always the same way but not depends on gradle plugins, as versiin etc… I use androdx. Appcompat version 1.2 and you?

probably aapt2 has different/stricter rules for what to enforce.

My real app has androidx.appcompat:appcompat:* (ie it IS on androidx already, but still has the issue). that said, it’s called app:alpha. MAYBE it just expects us to declare this in the apps own values. I’ll dig into that tomorrow. as now I really gotta run.

As you can see without yiur help and digging i have no chance to run it trying.in many ways during 4 weeks…

Androidx. Appcmpat version is importan one works anothwr not i tried with few 1.2,1.4,1.5.
Very strange think is that as works always prooerly but in lastest gradle plugins and as studio, with older you have to downgrade some library or update gradle plugins. One error many different solutions…

Actually, having thought about it, this probably is no good, as re-linking everything again will probably invalidate there IDs generated in there R.java from the first link, same as the old method. but worth a try.

I back to office … I’m downloading zip from firehose… give me a minute

Your solution is working for simple codescanner (identifiers are ok and view is loaded :heart_eyes:)
Now I will try with appcompat 1.2 simple application…

1 Like

For AppCompat I have the same bug you have :

maybe hint is here
https://googlesamples.github.io/android-custom-lint-rules/checks/UseAndroidAlpha.md.html

As I wrote something is going in gradle plugins…

Marc I changed in source lib xml files in one folder :
appcompat\res\color

line
xmlns:app=“http://schemas.android.com/apk/res-auto

to

xmlns:app=“http://schemas.android.com/apk/lib-res

and now we have another errors :

E:                   aapt2 link: resource style/Animation.AppCompat.Dialog (aka com.google.android.material:style/Animation.AppCompat.Dialog) not found.
E:                   aapt2 link: resource style/Animation.AppCompat.Dialog (aka com.google.android.material:style/Animation.AppCompat.Dialog) not found.
E:                   aapt2 link: resource attr/dialogPreferredPadding (aka com.google.android.material:attr/dialogPreferredPadding) not found. [/Users/mateusz/Library/Application Support/RemObjects Software/EBuild/Obj/inprax.pl.androidapplication-02C93115582694EB3C7255EAB4E9D2EE929CDEA0/Debug/Cooper-Android/aar/material-1.2.0/res/values/values.xml (458)]
E:                   aapt2 link: resource attr/dialogPreferredPadding (aka com.google.android.material:attr/dialogPreferredPadding) not found. [/Users/mateusz/Library/Application Support/RemObjects Software/EBuild/Obj/inprax.pl.androidapplication-02C93115582694EB3C7255EAB4E9D2EE929CDEA0/Debug/Cooper-Android/aar/material-1.2.0/res/values/values.xml (459)]
E:                   aapt2 link: resource dimen/abc_dialog_padding_top_material (aka com.google.android.material:dimen/abc_dialog_padding_top_material) not found. [/Users/mateusz/Library/Application Support/RemObjects Software/EBuild/Obj/inprax.pl.androidapplication-02C93115582694EB3C7255EAB4E9D2EE929CDEA0/Debug/Cooper-Android/aar/material-1.2.0/res/values/values.xml (460)]
E:                   aapt2 link: resource style/RtlOverlay.DialogWindowTitle.AppCompat (aka com.google.android.material:style/RtlOverlay.DialogWindowTitle.AppCompat) not found.
E:                   aapt2 link: resource style/TextAppearance.AppCompat (aka com.google.android.material:style/TextAppearance.AppCompat) not found.
E:                   aapt2 link: style attribute 'attr/fontFamily (aka com.google.android.material:attr/fontFamily)' not found. [/Users/mateusz/Library/Application Support/RemObjects Software/EBuild/Obj/inprax.pl.androidapplication-02C93115582694EB3C7255EAB4E9D2EE929CDEA0/Debug/Cooper-Android/aar/material-1.2.0/res/values/values.xml (472)]
E:                   aapt2 link: resource style/TextAppearance.AppCompat.Button (aka com.google.android.material:style/TextAppearance.AppCompat.Button) not found.
E:                   aapt2 link: style attribute 'attr/fontFamily (aka com.google.android.material:attr/fontFamily)' not found. [/Users/mateusz/Library/Application Support/RemObjects Software/EBuild/Obj/inprax.pl.androidapplication-02C93115582694EB3C7255EAB4E9D2EE929CDEA0/Debug/Cooper-Android/aar/material-1.2.0/res/values/values.xml (482)]
E:                   aapt2 link: resource style/TextAppearance.AppCompat.Title (aka com.google.android.material:style/TextAppearance.AppCompat.Title) not found.
E:                   aapt2 link: style attribute 'attr/fontFamily (aka com.google.android.material:attr/fontFamily)' not found. [/Users/mateusz/Library/Application Support/RemObjects Software/EBuild/Obj/inprax.pl.androidapplication-02C93115582694EB3C7255EAB4E9D2EE929CDEA0/Debug/Cooper-Android/aar/material-1.2.0/res/values/values.xml (491)]
E:                   aapt2 link: resource style/TextAppearance.AppCompat.Subhead (aka com.google.android.material:style/TextAppearance.AppCompat.Subhead) not found.
E:                   aapt2 link: style attribute 'attr/fontFamily (aka com.google.android.material:attr/fontFamily)' not found. [/Users/mateusz/Library/Application Support/RemObjects Software/EBuild/Obj/inprax.pl.androidapplication-02C93115582694EB3C7255EAB4E9D2EE929CDEA0/Debug/Cooper-Android/aar/material-1.2.0/res/values/values.xml (500)]
E:                   aapt2 link: resource style/Widget.AppCompat.ListView.Menu (aka com.google.android.material:style/Widget.AppCompat.ListView.Menu) not found. [/Users/mateusz/Library/Application Support/RemObjects Software/EBuild/Obj/inprax.pl.androidapplication-02C93115582694EB3C7255EAB4E9D2EE929CDEA0/Debug/Cooper-Android/aar/material-1.2.0/res/values/values.xml (511)]
E:                   aapt2 link: resource style/Animation.AppCompat.DropDownUp (aka com.google.android.material:style/Animation.AppCompat.DropDownUp) not found. [/Users/mateusz/Library/Application Support/RemObjects Software/EBuild/Obj/inprax.pl.androidapplication-02C93115582694EB3C7255EAB4E9D2EE929CDEA0/Debug/Cooper-Android/aar/material-1.2.0/res/values/values.xml (512)]
E:                   aapt2 link: resource dimen/abc_dialog_min_width_major (aka com.google.android.material:dimen/abc_dialog_min_width_major) not found. [/Users/mateusz/Library/Application Support/RemObjects Software/EBuild/Obj/inprax.pl.androidapplication-02C93115582694EB3C7255EAB4E9D2EE929CDEA0/Debug/Cooper-Android/aar/material-1.2.0/res/values/values.xml (516)]
E:                   aapt2 link: resource dimen/abc_dialog_min_width_minor (aka com.google.android.material:dimen/abc_dialog_min_width_minor) not found. [/Users/mateusz/Library/Application Support/RemObjects Software/EBuild/Obj/inprax.pl.androidapplication-02C93115582694EB3C7255EAB4E9D2EE929CDEA0/Debug/Cooper-Android/aar/material-1.2.0/res/values/values.xml (517)]
E:                   aapt2 link: style attribute 'attr/windowFixedWidthMajor (aka com.google.android.material:attr/windowFixedWidthMajor)' not found. [/Users/mateusz/Library/Application Support/RemObjects Software/EBuild/Obj/inprax.pl.androidapplication-02C93115582694EB3C7255EAB4E9D2EE929CDEA0/Debug/Cooper-Android/aar/material-1.2.0/res/values/values.xml (521)]
E:                   aapt2 link: style attribute 'attr/windowFixedWidthMinor (aka com.google.android.material:attr/windowFixedWidthMinor)' not found. [/Users/mateusz/Library/Application Support/RemObjects Software/EBuild/Obj/inprax.pl.androidapplication-02C93115582694EB3C7255EAB4E9D2EE929CDEA0/Debug/Cooper-Android/aar/material-1.2.0/res/values/values.xml (522)]

Update
I checked that in appcompat\res\values is style like this

<style name="Animation.AppCompat.Dialog" parent="Base.Animation.AppCompat.Dialog"/>

. It is in compiled res aapt2-compiled but not exists in R.java aapt2-java in folder appcompat of course.

Cool.That means we’re on the right track! :crossed_fingers:t3:

Good. I like consistency.

Will check.

one thing at a time?

Alpha is ok on my side - now animation.appcompat.dialog…
In newer version of appcompat xmls are teh same -res-auto not lib-res