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.
 

agraham

Expert
Licensed User
I have installed all the components labeled Constraint.
If this means you have been playing with the SDK Manager then start again with a fresh SDK installed exactly as here
and see if the problem persists.
 
Upvote 0

Ronald Berardinis

Member
Licensed User
If this means you have been playing with the SDK Manager then start again with a fresh SDK installed exactly as here
and see if the problem persists.

thank you for your suggestion.
I followed directions but now have a new error

Generating R file. Error
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\..\extras\b4a_remote\com\google\android\material\material\1.3.0\unpacked-material-1.3.0\res\layout\material_timepicker_dialog.xml:38: error: No resource identifier found for attribute 'barrierMargin' in package 'compuplus.abc_client'
c:\android\tools\..\extras\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').


these errors don't look like any variables in my code?

is this something in an XML file ?
 
Upvote 0

Ronald Berardinis

Member
Licensed User
There is a specific issue with constraintlayout-2.0.4. I guess that you are using the DJI library, right?

The solution was to set the sdk manager to download an older version of this resource. If you have already downloaded the problematic version then you need to delete it or start with a new SDK.

How can I determine what version i downloaded.
Is there anything in a directory that can be replaced or change some ini file ?
 
Upvote 0

Ronald Berardinis

Member
Licensed User
Do you still get any error?


Yes, still getting errors.
when you say to reinstall the SDK Manager
i believe you are speaking to this program.
1612792057730.png


On the how to install process what number installs this SDK Manager ?
i am referencing the address B4A – The simple way to develop native Android apps (b4x.com) https://www.b4x.com/b4a.html
How can i delete/uninstall and restart with different version.
 
Upvote 0

walterf25

Expert
Licensed User
I'm sorry to jump on this thread, but I am also having the issue with a project I created some time ago, my customer has asked me to make some small changes but now the project will not run as I am getting the following error:
Generating R file. Error
c:\android_sdk\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_sdk\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_sdk\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_sdk\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_sdk\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_sdk\tools\..\extras\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').

I have downloaded the command line tool and resources recommended on this link https://www.b4x.com/b4a.html and have created a new directory where I have placed those two folders but i am still seeing the same issue.

These are the libraries i am using if is of any help and i am using B4A 10.5.

libs.PNG
Any ideas?

Walter
 
Upvote 0

Erel

Administrator
Staff member
Licensed User
Upvote 0

Ronald Berardinis

Member
Licensed User
I'm sorry to jump on this thread, but I am also having the issue with a project I created some time ago, my customer has asked me to make some small changes but now the project will not run as I am getting the following error:


I have downloaded the command line tool and resources recommended on this link https://www.b4x.com/b4a.html and have created a new directory where I have placed those two folders but i am still seeing the same issue.

These are the libraries i am using if is of any help and i am using B4A 10.5.

View attachment 107696
Any ideas?

Walter


Like you, i did the same and downloaded the files and recreated the \Android directory as the installation instructions specified.
However, i did a second time but instead used the 7-Zip.exe to export the files.
The video on the instructions page shows a simple copy and paste using windows opening the zip files.
Instead use the 7-Zip.exe program to first save to a separate directory then copy to the \Android folder.
Strange but that got rid of the 2.0.4 issue.
then i had a reference in my program to #AdditionalJar: com.android.support:design which i commented out.
That was the cause of my 2nd problem.
Again, all worked fine with my B4A for years.
The project compiled without issues for 3 years.
Then one day, all of a sudden, i could not compile?
One of the suggested components in the SDK manger was installed that screwed my system up.
Next time i will not download unless i wait at least a month before bugs worked out.
 
Upvote 0

walterf25

Expert
Licensed User
What are you using DesignSupport for? This is probably the cause of this error.

Not sure where constraintlayout-2.0.4 comes from. The sdk manager should download a different version (1.1.3). Switching to v1.1.3 should solve this issue.
Follow these steps: https://www.b4x.com/android/forum/threads/dji-library-communication-error.126004/post-787611
The issue was the constraintlayout-2.0.4 when I looked inside that folder there were two versions 2.0.4 and 1.1.3 I deleted the 2.0.4 version and left only v1.1.3 and this fixed the issue.

Thanks,
Walter
 
Upvote 0
Top