'Does the Android native system support compiling using the databinding syntax?
I have done an app project on android studio before which uses jetpack toolset like databinding, viewModel etc. It is able to generate apk and works fine on mobile. I now want to port this project to the phone system and make it a system app. I put all the packages referenced in gradle into Android.mk, but the following problems occur in the compilation process.
packages/apps/CatchLog/res/layout/fragment_main.xml:155: error: attribute layoutManager (aka com.bsp.catchlog:layoutManager) not found.
packages/apps/CatchLog/res/layout/fragment_main.xml:176: error: '@{vm.PreferenceNum == 0 ? View.VISIBLE : View.GONE, default=visible}' is incompatible with attribute visibility (attr) enum [gone=2, invisible=1, visible=0].
packages/apps/CatchLog/res/layout/fragment_main.xml:182: error: '@{vm.PreferenceNum == 1 ? View.VISIBLE : View.GONE, default=gone}' is incompatible with attribute visibility (attr) enum [gone=2, invisible=1, visible=0].
packages/apps/CatchLog/res/layout/fragment_main.xml:188: error: '@{vm.PreferenceNum == 2 ? View.VISIBLE : View.GONE, default=gone}' is incompatible with attribute visibility (attr) enum [gone=2, invisible=1, visible=0].
packages/apps/CatchLog/res/layout/fragment_main.xml:194: error: '@{vm.PreferenceNum == 3 ? View.VISIBLE : View.GONE, default=gone}' is incompatible with attribute visibility (attr) enum [gone=2, invisible=1, visible=0].
packages/apps/CatchLog/res/layout/fragment_main.xml:200: error: '@{vm.PreferenceNum == 4 ? View.VISIBLE : View.GONE, default=gone}' is incompatible with attribute visibility (attr) enum [gone=2, invisible=1, visible=0].
packages/apps/CatchLog/res/layout/fragment_main.xml:207: error: '@{vm.PreferenceNum == 5 ? View.VISIBLE : View.GONE, default=gone}' is incompatible with attribute visibility (attr) enum [gone=2, invisible=1, visible=0].
packages/apps/CatchLog/res/layout/fragment_player.xml:156: error: attribute onSeekBarChangeListener (aka com.bsp.catchlog:onSeekBarChangeListener) not found.
packages/apps/CatchLog/res/layout/fragment_player.xml:156: error: '@{vm.timeSeekProgress}' is incompatible with attribute progress (attr) integer.
packages/apps/CatchLog/res/layout/fragment_player.xml:165: error: '@{vm.isStartStop? false:true,default=true}' is incompatible with attribute clickable (attr) boolean.
From the error, my understanding is that the system compilation does not understand some syntax of databinding. Does the current mobile phone system not support the compilation of jetpack packages such as databinding?
Part of the layout code:
<layout 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">
<data>
<import type="android.view.View"/>
<variable
name="click"
type="xxx.xxx.xxx.MainFragment.ClickProxy" />
<variable
name="vm"
type="xxx.xxx.xxx.ui.state.MainViewModel" />
<variable
name="adapter"
type="androidx.recyclerview.widget.ListAdapter" />
</data>
.........
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:orientation="vertical">
<include
android:id="@+id/preference_fragment_m"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="@{vm.PreferenceNum == 0 ? View.VISIBLE : View.GONE, default=visible}"
layout="@layout/main_preference_layout"/>
<include
android:id="@+id/preference_fragment_ap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="@{vm.PreferenceNum == 1 ? View.VISIBLE : View.GONE, default=gone}"
layout="@layout/ap_preference_layout"/>
<include
android:id="@+id/preference_fragment_bp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="@{vm.PreferenceNum == 2 ? View.VISIBLE : View.GONE, default=gone}"
layout="@layout/bp_preference_layout"/>
<include
android:id="@+id/preference_fragment_nw"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="@{vm.PreferenceNum == 3 ? View.VISIBLE : View.GONE, default=gone}"
layout="@layout/nw_preference_layout"/>
<include
android:id="@+id/preference_fragment_ex"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="@{vm.PreferenceNum == 4 ? View.VISIBLE : View.GONE, default=gone}"
layout="@layout/ex_preference_layout"/>
<WebView
android:id="@+id/web_view"
pageAssetPath="@{vm.pageAssetPath}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="@{vm.PreferenceNum == 5 ? View.VISIBLE : View.GONE, default=gone}"
android:clipToPadding="false" />
May I ask what is the reason for my error? Is it because the build system using android.mk is too old to recognize the layout syntax of jetpack? Can changing it to android.bp help? Thank you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
