As requested, I am re-posting my post from here as a question.
I was trying to load an xml-file using the new ConstraintLayout but I got an error while the R.file was generated:
This is the xml-file:
I noted that my project in Android Studio was using two dependencies:
-appcompat-v7
-constraint-layout
as can be shown here:
I tried to add the following two attributes in my B4A-project:
but it did not work.
Note: I tried first with 'com.android.support.constraint:constraint-layout' but it gives the error: 'Maven artifact not found: org.testng/testng' while using only 'constraint-layout' does not trigger any error.
Am I doing something wrong or is it simply B4A and the XMLLayoutBuilder library which cannot handle this new layout?
I was trying to load an xml-file using the new ConstraintLayout but I got an error while the R.file was generated:
B4X:
B4A version: 6.30
Parsing code. (0.00s)
Compiling code. (0.07s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Generating R file. Error
res\layout\layxml.xml:10: error: No resource identifier found for attribute 'layout_constraintTop_toTopOf' in package 'b4a.example'
res\layout\layxml.xml:10: error: No resource identifier found for attribute 'layout_constraintBottom_toBottomOf' in package 'b4a.example'
res\layout\layxml.xml:10: error: No resource identifier found for attribute 'layout_constraintLeft_toLeftOf' in package 'b4a.example'
res\layout\layxml.xml:10: error: No resource identifier found for attribute 'layout_constraintRight_toRightOf' in package 'b4a.example'
This is the xml-file:
B4X:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.mikael.myapplication.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:layout_marginTop="16dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp"
android:id="@+id/txtbox1" />
</android.support.constraint.ConstraintLayout>
I noted that my project in Android Studio was using two dependencies:
-appcompat-v7
-constraint-layout
as can be shown here:
B4X:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
}
I tried to add the following two attributes in my B4A-project:
B4X:
#AdditionalJar: com.android.support:appcompat-v7
#AdditionalJar: constraint-layout
Note: I tried first with 'com.android.support.constraint:constraint-layout' but it gives the error: 'Maven artifact not found: org.testng/testng' while using only 'constraint-layout' does not trigger any error.
Am I doing something wrong or is it simply B4A and the XMLLayoutBuilder library which cannot handle this new layout?