Fixed databinding build issue that happens sometimes, caused by property & get/set functions names colliding

This commit is contained in:
Sylvain Berfini 2020-10-22 14:14:00 +02:00
parent 55c4c908a8
commit 4f667c7734
2 changed files with 6 additions and 8 deletions

View file

@ -91,8 +91,6 @@ LinphoneSdkBuildDir=/home/<username>/linphone-sdk/build/
- If you encounter the `couldn't find "libc++_shared.so"` crash when the app starts, simply clean the project in Android Studio (under Build menu) and build again. - If you encounter the `couldn't find "libc++_shared.so"` crash when the app starts, simply clean the project in Android Studio (under Build menu) and build again.
Also check you have built the SDK for the right CPU architecture using the `-DLINPHONESDK_ANDROID_ARCHS=armv7,arm64,x86,x86_64` cmake parameter. Also check you have built the SDK for the right CPU architecture using the `-DLINPHONESDK_ANDROID_ARCHS=armv7,arm64,x86,x86_64` cmake parameter.
- If during the build you have `DataBinderMapperImpl.java error: cannot find symbol`, `Could not find accessor org.linphone.activities.main.chat.viewmodels.ChatRoomsListViewModel.chatRooms` or `Could not find accessor org.linphone.activities.main.settings.viewmodels.NetworkSettingsViewModel.sipPort`, try building again. It is merely a build failure from Android Studio that happens sometimes.
- Push notification might not work when app has been started by Android Studio consecutively to an install. Remove the app from the recent activity view and start it again using the launcher icon to resolve this. - Push notification might not work when app has been started by Android Studio consecutively to an install. Remove the app from the recent activity view and start it again using the launcher icon to resolve this.
## Troubleshouting ## Troubleshouting

View file

@ -56,7 +56,7 @@ class NetworkSettingsViewModel : GenericSettingsViewModel() {
val randomPortsListener = object : SettingListenerStub() { val randomPortsListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) { override fun onBoolValueChanged(newValue: Boolean) {
val port = if (newValue) -1 else 5060 val port = if (newValue) -1 else 5060
setSipPort(port) setTransportPort(port)
sipPort.value = port sipPort.value = port
} }
} }
@ -66,7 +66,7 @@ class NetworkSettingsViewModel : GenericSettingsViewModel() {
override fun onTextValueChanged(newValue: String) { override fun onTextValueChanged(newValue: String) {
try { try {
val port = newValue.toInt() val port = newValue.toInt()
setSipPort(port) setTransportPort(port)
} catch (nfe: NumberFormatException) { } catch (nfe: NumberFormatException) {
} }
} }
@ -79,11 +79,11 @@ class NetworkSettingsViewModel : GenericSettingsViewModel() {
pushNotifications.value = core.isPushNotificationEnabled pushNotifications.value = core.isPushNotificationEnabled
pushNotificationsAvailable.value = core.isPushNotificationAvailable pushNotificationsAvailable.value = core.isPushNotificationAvailable
legacyPushNotificationFormat.value = prefs.useLegacyPushNotificationFormat legacyPushNotificationFormat.value = prefs.useLegacyPushNotificationFormat
randomPorts.value = getSipPort() == -1 randomPorts.value = getTransportPort() == -1
sipPort.value = getSipPort() sipPort.value = getTransportPort()
} }
private fun setSipPort(port: Int) { private fun setTransportPort(port: Int) {
val transports = core.transports val transports = core.transports
transports.udpPort = port transports.udpPort = port
transports.tcpPort = port transports.tcpPort = port
@ -91,7 +91,7 @@ class NetworkSettingsViewModel : GenericSettingsViewModel() {
core.transports = transports core.transports = transports
} }
private fun getSipPort(): Int { private fun getTransportPort(): Int {
val transports = core.transports val transports = core.transports
if (transports.udpPort > 0) return transports.udpPort if (transports.udpPort > 0) return transports.udpPort
return transports.tcpPort return transports.tcpPort