Android Databinding for Custom View: 'cannot find symbol' and 'duplicate class found'
I have previously changed some code in my project and now there is the following error thrown during compilation for the following auto-generated class:
DataBinderMapperImpl.java : cannot find symbol "AdvancedBoxBindingImpl" (in line 'import ...databinding.AdvancedBoxBindingImpl;')
The AdvancedBox is included in the the layout fragment_config.xml like this:
<layout xmlns:bind="http://schemas.android.com/tools">
<data>
<import type="android.view.View"/>
<variable name="viewModel" type ="...GlobalConfigViewModel"/>
</data>
...
<....AdvancedBox
android:id="@+id/advancedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:viewModel = "@{viewModel}"
android:visibility="@{viewModel.advancedShown ? View.VISIBLE : View.GONE}"/>
...
</layout>
The advanced_box.xml looks like this:
<layout>
<data>
<import type="android.view.View"/>
<variable
name="viewModel"
type="...GlobalConfigViewModel" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
....
The binding in the AdvancedBox-class is instantiated like this:
class AdvancedBox : LinearLayout{
private lateinit var mBinding: AdvancedBoxBinding
init{
mBinding = AdvancedBoxBinding.inflate(inflater, this, true)
}
All of this previously worked, but I have recently updated Android Studio and made changes in the Code.
Additional Information:
- gradle.properties has the attribute 'android.databinding.enableV2=true'
- I have tried File->Invalidate Caches and Restart
Any suggestions on what might be the problem?
android android-databinding
add a comment |
I have previously changed some code in my project and now there is the following error thrown during compilation for the following auto-generated class:
DataBinderMapperImpl.java : cannot find symbol "AdvancedBoxBindingImpl" (in line 'import ...databinding.AdvancedBoxBindingImpl;')
The AdvancedBox is included in the the layout fragment_config.xml like this:
<layout xmlns:bind="http://schemas.android.com/tools">
<data>
<import type="android.view.View"/>
<variable name="viewModel" type ="...GlobalConfigViewModel"/>
</data>
...
<....AdvancedBox
android:id="@+id/advancedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:viewModel = "@{viewModel}"
android:visibility="@{viewModel.advancedShown ? View.VISIBLE : View.GONE}"/>
...
</layout>
The advanced_box.xml looks like this:
<layout>
<data>
<import type="android.view.View"/>
<variable
name="viewModel"
type="...GlobalConfigViewModel" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
....
The binding in the AdvancedBox-class is instantiated like this:
class AdvancedBox : LinearLayout{
private lateinit var mBinding: AdvancedBoxBinding
init{
mBinding = AdvancedBoxBinding.inflate(inflater, this, true)
}
All of this previously worked, but I have recently updated Android Studio and made changes in the Code.
Additional Information:
- gradle.properties has the attribute 'android.databinding.enableV2=true'
- I have tried File->Invalidate Caches and Restart
Any suggestions on what might be the problem?
android android-databinding
Would you please try to delete the build folder and then clean build?
– Faysal Ahmed
Nov 26 '18 at 12:15
add a comment |
I have previously changed some code in my project and now there is the following error thrown during compilation for the following auto-generated class:
DataBinderMapperImpl.java : cannot find symbol "AdvancedBoxBindingImpl" (in line 'import ...databinding.AdvancedBoxBindingImpl;')
The AdvancedBox is included in the the layout fragment_config.xml like this:
<layout xmlns:bind="http://schemas.android.com/tools">
<data>
<import type="android.view.View"/>
<variable name="viewModel" type ="...GlobalConfigViewModel"/>
</data>
...
<....AdvancedBox
android:id="@+id/advancedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:viewModel = "@{viewModel}"
android:visibility="@{viewModel.advancedShown ? View.VISIBLE : View.GONE}"/>
...
</layout>
The advanced_box.xml looks like this:
<layout>
<data>
<import type="android.view.View"/>
<variable
name="viewModel"
type="...GlobalConfigViewModel" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
....
The binding in the AdvancedBox-class is instantiated like this:
class AdvancedBox : LinearLayout{
private lateinit var mBinding: AdvancedBoxBinding
init{
mBinding = AdvancedBoxBinding.inflate(inflater, this, true)
}
All of this previously worked, but I have recently updated Android Studio and made changes in the Code.
Additional Information:
- gradle.properties has the attribute 'android.databinding.enableV2=true'
- I have tried File->Invalidate Caches and Restart
Any suggestions on what might be the problem?
android android-databinding
I have previously changed some code in my project and now there is the following error thrown during compilation for the following auto-generated class:
DataBinderMapperImpl.java : cannot find symbol "AdvancedBoxBindingImpl" (in line 'import ...databinding.AdvancedBoxBindingImpl;')
The AdvancedBox is included in the the layout fragment_config.xml like this:
<layout xmlns:bind="http://schemas.android.com/tools">
<data>
<import type="android.view.View"/>
<variable name="viewModel" type ="...GlobalConfigViewModel"/>
</data>
...
<....AdvancedBox
android:id="@+id/advancedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:viewModel = "@{viewModel}"
android:visibility="@{viewModel.advancedShown ? View.VISIBLE : View.GONE}"/>
...
</layout>
The advanced_box.xml looks like this:
<layout>
<data>
<import type="android.view.View"/>
<variable
name="viewModel"
type="...GlobalConfigViewModel" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
....
The binding in the AdvancedBox-class is instantiated like this:
class AdvancedBox : LinearLayout{
private lateinit var mBinding: AdvancedBoxBinding
init{
mBinding = AdvancedBoxBinding.inflate(inflater, this, true)
}
All of this previously worked, but I have recently updated Android Studio and made changes in the Code.
Additional Information:
- gradle.properties has the attribute 'android.databinding.enableV2=true'
- I have tried File->Invalidate Caches and Restart
Any suggestions on what might be the problem?
android android-databinding
android android-databinding
asked Nov 24 '18 at 17:44
DoflaminhgoDoflaminhgo
1229
1229
Would you please try to delete the build folder and then clean build?
– Faysal Ahmed
Nov 26 '18 at 12:15
add a comment |
Would you please try to delete the build folder and then clean build?
– Faysal Ahmed
Nov 26 '18 at 12:15
Would you please try to delete the build folder and then clean build?
– Faysal Ahmed
Nov 26 '18 at 12:15
Would you please try to delete the build folder and then clean build?
– Faysal Ahmed
Nov 26 '18 at 12:15
add a comment |
2 Answers
2
active
oldest
votes
where have you specified the binding class inside xml? I think that's the issue
<layout>
<data class="AdvancedBoxBinding">
<import type="android.view.View"/>
<variable
name="viewModel"
type="...GlobalConfigViewModel" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
add a comment |
Possible problem with the way data has been bound to the view.
In my case, I had a model :
<data>
<variable name="user" type="zw.org.coop.models.User"/>
</data>
but because of copy pasting, I had a typo like :
<TextView
android:id="@+id/fullName"
style="@style/styleEditText"
android:layout_width="match_parent"
android:layout_height="35dp"
android:padding="5dp"
android:text="@{user.user.firstName}"
android:textSize="12sp"
tools:text="Dean Kaila" />
where user.user.firstName was not intend but user.firstName
Would've been better if Jetbrains had some intellisense going on to help with such issues, but yeah, that was a good 2 days for me.
Hope this helps someone.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53460833%2fandroid-databinding-for-custom-view-cannot-find-symbol-and-duplicate-class-f%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
where have you specified the binding class inside xml? I think that's the issue
<layout>
<data class="AdvancedBoxBinding">
<import type="android.view.View"/>
<variable
name="viewModel"
type="...GlobalConfigViewModel" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
add a comment |
where have you specified the binding class inside xml? I think that's the issue
<layout>
<data class="AdvancedBoxBinding">
<import type="android.view.View"/>
<variable
name="viewModel"
type="...GlobalConfigViewModel" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
add a comment |
where have you specified the binding class inside xml? I think that's the issue
<layout>
<data class="AdvancedBoxBinding">
<import type="android.view.View"/>
<variable
name="viewModel"
type="...GlobalConfigViewModel" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
where have you specified the binding class inside xml? I think that's the issue
<layout>
<data class="AdvancedBoxBinding">
<import type="android.view.View"/>
<variable
name="viewModel"
type="...GlobalConfigViewModel" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
answered Nov 26 '18 at 11:58
ABrABr
19017
19017
add a comment |
add a comment |
Possible problem with the way data has been bound to the view.
In my case, I had a model :
<data>
<variable name="user" type="zw.org.coop.models.User"/>
</data>
but because of copy pasting, I had a typo like :
<TextView
android:id="@+id/fullName"
style="@style/styleEditText"
android:layout_width="match_parent"
android:layout_height="35dp"
android:padding="5dp"
android:text="@{user.user.firstName}"
android:textSize="12sp"
tools:text="Dean Kaila" />
where user.user.firstName was not intend but user.firstName
Would've been better if Jetbrains had some intellisense going on to help with such issues, but yeah, that was a good 2 days for me.
Hope this helps someone.
add a comment |
Possible problem with the way data has been bound to the view.
In my case, I had a model :
<data>
<variable name="user" type="zw.org.coop.models.User"/>
</data>
but because of copy pasting, I had a typo like :
<TextView
android:id="@+id/fullName"
style="@style/styleEditText"
android:layout_width="match_parent"
android:layout_height="35dp"
android:padding="5dp"
android:text="@{user.user.firstName}"
android:textSize="12sp"
tools:text="Dean Kaila" />
where user.user.firstName was not intend but user.firstName
Would've been better if Jetbrains had some intellisense going on to help with such issues, but yeah, that was a good 2 days for me.
Hope this helps someone.
add a comment |
Possible problem with the way data has been bound to the view.
In my case, I had a model :
<data>
<variable name="user" type="zw.org.coop.models.User"/>
</data>
but because of copy pasting, I had a typo like :
<TextView
android:id="@+id/fullName"
style="@style/styleEditText"
android:layout_width="match_parent"
android:layout_height="35dp"
android:padding="5dp"
android:text="@{user.user.firstName}"
android:textSize="12sp"
tools:text="Dean Kaila" />
where user.user.firstName was not intend but user.firstName
Would've been better if Jetbrains had some intellisense going on to help with such issues, but yeah, that was a good 2 days for me.
Hope this helps someone.
Possible problem with the way data has been bound to the view.
In my case, I had a model :
<data>
<variable name="user" type="zw.org.coop.models.User"/>
</data>
but because of copy pasting, I had a typo like :
<TextView
android:id="@+id/fullName"
style="@style/styleEditText"
android:layout_width="match_parent"
android:layout_height="35dp"
android:padding="5dp"
android:text="@{user.user.firstName}"
android:textSize="12sp"
tools:text="Dean Kaila" />
where user.user.firstName was not intend but user.firstName
Would've been better if Jetbrains had some intellisense going on to help with such issues, but yeah, that was a good 2 days for me.
Hope this helps someone.
answered Dec 31 '18 at 23:12
geekInMegeekInMe
10518
10518
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53460833%2fandroid-databinding-for-custom-view-cannot-find-symbol-and-duplicate-class-f%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Would you please try to delete the build folder and then clean build?
– Faysal Ahmed
Nov 26 '18 at 12:15