Android App crash on startup on 2809 and with aapt2

Helo,
I have another problem with my app (with my own library dependency and google and third party).
App is running and before showing main activity I see
!> Message: Failed resolution of: Landroidx/appcompat/R$drawable;

I made some smaller app and it works but I have to run this one (count of DEX files is different between projects smaller working has 55 dex appropriate 58 dex) but I don’t know what to do with this problem…
I should mention that this app before changing to aapt2 resources build and work fine on Windows machine , but as we know there (on Windows) is problem with aapt2 so I moved to Fire.

What should I give you to analyze this problem ?

Best regards
Mateusz

Can you compare what resources are in the old (aapt*1) one vs the new (aaprt2) one, using “ebuild --dump”?

How ?? I didn’t use it…??
Should I build this apk without useaapt2 on Fire ?
When I set useaapt2 to false apk is generated with flat resources…

You said you had an older working, apk. Dump that and the new ones and compare.

Old working apk
dump.txt (1.0 MB)

Apk builded in Fire
dump_mac.txt (1.1 MB)
There are differnces but why ?

Could be many things. different versions of there referenced packages, aapt2 doing things slightly different, etc.

I dont see androidx.appcompat.R in either version, though. But I do see many other R classes that far win old, but not new. This might be as designed though, I vaguely recall an issue where we have loads of dupe R.java files (same content from each package) that caused problems, and that dropping them was the righty fix…

Can you post the entire crash log? usually there’s many nested exceptions hiding the real problem.

the IDEAL case would be if we had an identical project (same set of package references) that fails build with Elements, but works built with Android Studio, and we could compare the dump of tbose two…

How to get it in Fire I have only one line i mentioned…?
Message: Failed resolution of: Landroidx/appcompat/R$drawable;

I don’t have AS studio project…I don’t know this tool - I prefer yours, I Made some simple project there, and build some third party library.

Actually my bad androidx.appcopt.R is there in old, and not in new. So that could be the problem. I can go back and review why this was "fixed"and see if revering that solves it and.or causes more issues.

I’m afraid you have to look at logcat (add logcat in Terminal) and wade thru, literally, tens of thousands of bullshit messages to find the ones relevant to your process (filtering by your app name wont help, and that’ll lose you too much, but searching for it usually helps.

Welcome to the wonderful Android platform. :upside_down_face:

??

Nevermind. That fix was actually already undone, thats to the issue. aap2 doesnt seem to generate this R.java files, aapt(1) did.

I’m investigating the what is going on wrong…
and the question is what broke this app in aapt2 …

1 Like

This strange error is coming from appcompatlib … the simple test case is located below
inprax.pl.androidapplication.zip (88.5 KB)
If you change to Activity all works fine but for my application I use AppCompatActivity

Maybe I missed something in references but the same dependencies has been working until today and aapt2.
Mateusz

Yeah, in my experience it all goes south once you depend on the external packages :(.

I’ll have a look. What error am l looking for? I hate “blind” test cases…

Curiously right now I get

D:                      Checking repository https://dl.google.com/dl/android/maven2
HTTP Exception 'Error: ConnectFailure (No route to host)' trying to load 'https://dl.google.com/dl/android/maven2/androidx/appcompat/appcompat/maven%2Dmetadata.xml'
D:                      Checking repository https://repo1.maven.org/maven2
D:                      Checking repository https://jcenter.bintray.com/
E:                      Gradle package androidx.appcompat:appcompat Version [1.2.0] not found in any repositories.
                     <- Task RemObjects.EBuild.Elements.ElementsProcessGradleReferences failed for inprax.pl.androidapplication, Cooper-Android, took 1.1153s (1.115s).

it looks like Google’s repo is down. indeed that url gives me a 404. yay.

I choose rebuild and all works fine…

No such luck here.

can I see the

                 -> Task RemObjects.EBuild.Elements.ElementsProcessGradleReferences started for inprax.pl.androidapplication, Cooper-Android.

section of your log, to see what URL it finds the package at? Rebuild should bypass your local cache and always try and get it remotely… Clearly/unfortunately I don’t have a copy in my local cache form earlier…

gradle.txt (63.0 KB)

Simple App where mainaictivity inherit from AppCompatActivity works fine in Android Studio…ehhh

ok, pls send me both apks (or their dumps) also: