Android Question Generating R File Errors. Constraintlayout 2.0.4. Has already been defined.

Ronald Berardinis

Member
Licensed User
I am getting this strange errors that came out of nowhere?

Generating R file. Error
c:\android\tools\..\extras\b4a_remote\androidx\constraintlayout\constraintlayout\2.0.4\unpacked-constraintlayout-2.0.4\res\values\values.xml:339: error: Attribute "android:alpha" has already been defined
c:\android\tools\..\extras\b4a_remote\androidx\constraintlayout\constraintlayout\2.0.4\unpacked-constraintlayout-2.0.4\res\values\values.xml:342: error: Attribute "android:translationX" has already been defined
c:\android\tools\..\extras\b4a_remote\androidx\constraintlayout\constraintlayout\2.0.4\unpacked-constraintlayout-2.0.4\res\values\values.xml:342: error: Attribute "android:translationY" has already been defined
c:\android\tools\..\extras\b4a_remote\androidx\constraintlayout\constraintlayout\2.0.4\unpacked-constraintlayout-2.0.4\res\values\values.xml:342: error: Attribute "android:translationZ" has already been defined
c:\android\tools\..\extras\b4a_remote\com\google\android\material\material\1.3.0\unpacked-material-1.3.0\res\layout\material_clock_period_toggle.xml:18: error: Error: No resource found that matches the given name (at 'checkedButton' with value '@id/material_clock_period_am_button').
c:\android\tools\..\extr
as\b4a_remote\com\google\android\material\material\1.3.0\unpacked-material-1.3.0\res\layout\material_timepicker_dialog.xml:82: error: Error: No resource found that matches the given name (at 'layout_constraintEnd_toStartOf' with value '@id/material_timepicker_ok_button').



One day all is great and next day error pops up about constraintLayout?
I have installed all the components labeled Constraint.
It does not make any sense that you can have a large list constraint components that all relate to the same thing ?
Why not just one Constraint library or component or whatever these installed stuff is called?
BTW, I am using B4A version 10.5



In my installed-components.txt file i see these entries and i believe it is related to the error i am getting


com.google.android.material\:material=1.3.0
androidx.constraintlayout\:constraintlayout=2.0.4

What is the solution to fix my errors so i can compile the program successfully?

Thank you for any help you can give me on this.
 

Greg Breinholt

Member
Licensed User
Longtime User
Yes 10.5.
I deleted and re-installed... but this time did not install any of the automatically selected Recommended items in the SDK Manager (though I had to search and add a few or could not compile)... and it now compiles again.

I still see version 2.0.4 for the Constraints - but definitely not selecting it (or any of the other recommended, until I know what break things!)
 
Upvote 0

delgadol

Member
Yes 10.5.
I deleted and re-installed... but this time did not install any of the automatically selected Recommended items in the SDK Manager (though I had to search and add a few or could not compile)... and it now compiles again.

I still see version 2.0.4 for the Constraints - but definitely not selecting it (or any of the other recommended, until I know what break things!)

you need to reinstall the old sdk backup, there are several error if your app have the next lib : app compact or desig support. if you have a datetime material dialogs, they depend from appcompact and it theme. need change this elements to b4xuiĀŗor equivalent.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
While you are checking is there any reason for this error? Download a new SDK, install per instructions, run SDK Manager, get error!
2021-02-12_090814.png


EDIT: It's magically fixed itself somehow :confused:
 
Last edited:
Upvote 0

scsjc

Well-Known Member
Licensed User
Longtime User
I fixed the problem restore manually backup files, with a versions:

-android.x.constraintlayout:constraintlayout 1.1.3
-android.x.constraintlayout:constraintlayout-solver 1.1.3

but in SDKManager I can't restore directly, because it doesn't give me the option of version 1.1.3
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
think the warning in the setup against using the SDK Manager needs to be stronger. We have had several occurrences in the last few days of people breaking things by playing with the SDK Manager.
I've removed the androidx resources from the list of recommended items. This way it will not be updated by default.

If you get this error: "Found tag id where item is expected" then you need to rollback the version of the mentioned resource. It is done by editing <sdk folder>\extras\b4a_remote\installed-components.txt
This list the available resources and the version that will be used. You can set a different version there. You can see the available versions under the androidx folder.

Note that you need to clean the project (ctrl + p) to force the IDE to reload the libraries.
 
Upvote 0
Top