@mh
on MAC with FIRE
I think you have bug in your AAPT2 with every dependency - I don’t know where is the problem exactly but every dependency gave me error like :
Failed resolution of: Lcom/budiyev/android/codescanner/R$drawable;
For appcompat there is the same error bu starting with appcomat. I think that problem is something in resources or their identifiers (I looked into your log as I know steps are ok but the results is not).
1.I did for investigation simple app with one simpe dependency (com.budiyev.android:code-scanner) and only use main control (code scanner) and in Fire with aapt2 is not working
When I used this library before aapt2 I ran it without any problems (Compiled in old manner in old Rems it works) - I will add all my example at the end of this post.
2.I did the same simple app with the same layout in Android Studio and this one works properly too
3.I compiled and ran the same app from point 1 in old remobjects using aapt and works fine too.
We still talking about problems with dependency (any dependency) and I think resources compiled in new way.
I found in documentation something like this
Incorrect configuration of libraries
If your app has a dependency on a third-party library that was built using older versions of the Android SDK Build Tools, your app might crash at runtime without displaying any errors or warnings. This crash might occur because during the library’s creation, the R.java
fields are declared final
. As a result, all the resource IDs are inlined in the library’s classes.
AAPT2 relies on being able to re-assign IDs to library resources when building your app. If the library assumes the IDs are final
and inlines them in the library DEX, there is a runtime mismatch.
To resolve this error, contact the library author to rebuild the library using the latest version of the Android SDK Build Tools, and republish the library.
but I have no idea how it can affect on your toolchain.
I think that we have problems here with R.java identifiers or something around that.
I wanted to find out how AS building it step by step but I can’t find it…I don’t know where this intermediate process is logged.
Summary : after 4 weeks of fight only one thing I can say Android Platform is not working in Remobjects after aapt2 but as I red Xamarin is working with aapt2 and I checked Android Studio is working too so the problem is inside toolchain.
You have to run this simple dependency (is simple because have only 5 resources files , maybe 6).
When you compile resources you did flat file for res/values but inside app the related values are not to merged in res folder - is it by design ?
Marc maybe the problem is simple but you have to spend time on it and try to run this simple app from attachment on Mac in Fire (because as I saw you did steps in good order but …it doesn’t work - we have to search around identifiers but only you have knowledge about compiling, dexing and using R.Java inside.
One difference I see for older aapt tools for lib you generated seperate R.java and one R.java for apk, now using aapt2 you did one for all.
Second difference in apk res/folder for this simple app is that drawable-hdpi which is in source and has one png is copied into drawable-hdpi-4 but Android Studio keeps folders consistent.
Attachments :
inprax.pl.testapp.zip (631.3 KB)
Fire app with this one dependency (working without aapt2 on Windows in older version, not working in Fire on MAC - crashed after start with
Failed resolution of: Lcom/budiyev/android/codescanner/R$drawable;
There is no difference if I use in this simple example gradle or local aar whose are in folder aar.
Android Studio working app with this one dependency and the same view
MyApplication3.zip (1.6 MB)
I’m sure that you can solve this error in short time because you have knowledge about toolchain - if you will not do it in short time I will have to leave your tools because now simple testcase is not working and when google will change something in future I will probably spend time on it again (without success).
Next week I have to migrate to AS with my apps if you will not run it , but I don’t want it - its time for you to solve this.
I love your tools but now ANDROID PLATFORM IS DEAD but I need it as well as .NET Core and IOS.
Hope for a quick solution to the problem.
I use all the knowledge I have gained so far
Update
Look into in linking resources (maybe something here will be helpfull)
--non-final-ids
Generates R.java
with non-final resource IDs. References to the IDs from app’s code aren’t inlined during kotlinc
or javac
compilation.
Best regards, tired aapt2 with dependency
Mateusz