Getting error “androidx.appcompat.widget.N cannot be cast to com.google.android.material.button.MaterialButton”R cannot be resolved - Android errorGet screen dimensions in pixels'Must Override a Superclass Method' Errors after importing a project into EclipseStatic way to get 'Context' in Android?“Debug certificate expired” error in Eclipse Android plugins“Conversion to Dalvik format failed with error 1” on external JARIs there a way to get the source code from an APK file?How to get the build/version number of your Android application?Get current time and date on Android“cannot resolve symbol R” in Android Studio
Density of twin square-free numbers
How can a class have multiple methods without breaking the single responsibility principle
How to prevent a single-element caster from being useless against immune foes?
Using Python in a Bash Script
The grades of the students in a class
GDPR Compliance - notification of data breach
Help me, I hate squares!
What is my clock telling me to do?
Was Donald Trump at ground zero helping out on 9-11?
Create and use Object Variable
Why are we moving in circles with a tandem kayak?
No Shirt, No Shoes, Service
What is the oxidation state of Mn in HMn(CO)5?
How can you tell the version of Ubuntu on a system in a .sh (bash) script?
How do I safety check that there is no light in Darkroom / Darkbag?
What Marvel character has this 'W' symbol?
How can flights operated by the same company have such different prices when marketed by another?
Should students have access to past exams or an exam bank?
Correct word for a little toy that always stands up?
Balancing Humanoid fantasy races: Elves
Introduction to the Sicilian
What force enables us to walk? Friction or normal reaction?
How to remove rebar passing through an inaccessible pipe
Is it unprofessional to mention your cover letter and resume are best viewed in Chrome?
Getting error “androidx.appcompat.widget.N cannot be cast to com.google.android.material.button.MaterialButton”
R cannot be resolved - Android errorGet screen dimensions in pixels'Must Override a Superclass Method' Errors after importing a project into EclipseStatic way to get 'Context' in Android?“Debug certificate expired” error in Eclipse Android plugins“Conversion to Dalvik format failed with error 1” on external JARIs there a way to get the source code from an APK file?How to get the build/version number of your Android application?Get current time and date on Android“cannot resolve symbol R” in Android Studio
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I migrated my app to androidx, and now in the released version, I'm getting that error. It works fine in all my tests, even the test lab doesn't find that error.
I've checked through every reference for it and they're all fine.
The line with the error:
private MaterialButton mShiftStartDate;
private void getVars()
.
mShiftStartDate = v.findViewById(R.id.shift_start_date_tv);
.
and the xml:
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:id="@id/shift_start_date_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textSize="18sp"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="@id/shift_start_date_label"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="@id/shift_start_date_label"
app:layout_constraintTop_toBottomOf="@id/shift_start_date_label"
tools:text="10/10/18" />
and parts of build.gradle
defaultConfig
applicationId appId
targetSdkVersion 28
minSdkVersion 19
versionCode buildCode
versionName versionMajor+"."+versionMinor+"."+versionRevision+"."+versionBuild
resValue "string", "CURRENT_VERSION", versionName
compileOptions
sourceCompatibility 1.8
targetCompatibility 1.8
dependencies
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha03'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'androidx.preference:preference:1.1.0-alpha04'
implementation 'androidx.annotation:annotation:1.1.0-alpha02'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'android.arch.navigation:navigation-fragment:1.0.0'
implementation 'android.arch.navigation:navigation-ui:1.0.0'
implementation 'com.google.android.gms:play-services-ads-lite:17.2.0'
implementation 'com.google.android.gms:play-services-oss-licenses:16.0.2'
implementation 'org.jetbrains:annotations:17.0.0'
Searching for it doesn't turn up any other examples of the problem. The only thing I can think of is proguard is renaming something it shouldn't. Since I can't manage to reproduce it (It's only happened to 5 users, but 26 times for them in all) in any emulator or using test devices, I can't test something like
-keep class androidx.appcompat.widget.** *;
which is all I can think to do.
android androidx android-jetpack
add a comment |
I migrated my app to androidx, and now in the released version, I'm getting that error. It works fine in all my tests, even the test lab doesn't find that error.
I've checked through every reference for it and they're all fine.
The line with the error:
private MaterialButton mShiftStartDate;
private void getVars()
.
mShiftStartDate = v.findViewById(R.id.shift_start_date_tv);
.
and the xml:
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:id="@id/shift_start_date_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textSize="18sp"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="@id/shift_start_date_label"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="@id/shift_start_date_label"
app:layout_constraintTop_toBottomOf="@id/shift_start_date_label"
tools:text="10/10/18" />
and parts of build.gradle
defaultConfig
applicationId appId
targetSdkVersion 28
minSdkVersion 19
versionCode buildCode
versionName versionMajor+"."+versionMinor+"."+versionRevision+"."+versionBuild
resValue "string", "CURRENT_VERSION", versionName
compileOptions
sourceCompatibility 1.8
targetCompatibility 1.8
dependencies
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha03'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'androidx.preference:preference:1.1.0-alpha04'
implementation 'androidx.annotation:annotation:1.1.0-alpha02'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'android.arch.navigation:navigation-fragment:1.0.0'
implementation 'android.arch.navigation:navigation-ui:1.0.0'
implementation 'com.google.android.gms:play-services-ads-lite:17.2.0'
implementation 'com.google.android.gms:play-services-oss-licenses:16.0.2'
implementation 'org.jetbrains:annotations:17.0.0'
Searching for it doesn't turn up any other examples of the problem. The only thing I can think of is proguard is renaming something it shouldn't. Since I can't manage to reproduce it (It's only happened to 5 users, but 26 times for them in all) in any emulator or using test devices, I can't test something like
-keep class androidx.appcompat.widget.** *;
which is all I can think to do.
android androidx android-jetpack
add a comment |
I migrated my app to androidx, and now in the released version, I'm getting that error. It works fine in all my tests, even the test lab doesn't find that error.
I've checked through every reference for it and they're all fine.
The line with the error:
private MaterialButton mShiftStartDate;
private void getVars()
.
mShiftStartDate = v.findViewById(R.id.shift_start_date_tv);
.
and the xml:
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:id="@id/shift_start_date_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textSize="18sp"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="@id/shift_start_date_label"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="@id/shift_start_date_label"
app:layout_constraintTop_toBottomOf="@id/shift_start_date_label"
tools:text="10/10/18" />
and parts of build.gradle
defaultConfig
applicationId appId
targetSdkVersion 28
minSdkVersion 19
versionCode buildCode
versionName versionMajor+"."+versionMinor+"."+versionRevision+"."+versionBuild
resValue "string", "CURRENT_VERSION", versionName
compileOptions
sourceCompatibility 1.8
targetCompatibility 1.8
dependencies
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha03'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'androidx.preference:preference:1.1.0-alpha04'
implementation 'androidx.annotation:annotation:1.1.0-alpha02'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'android.arch.navigation:navigation-fragment:1.0.0'
implementation 'android.arch.navigation:navigation-ui:1.0.0'
implementation 'com.google.android.gms:play-services-ads-lite:17.2.0'
implementation 'com.google.android.gms:play-services-oss-licenses:16.0.2'
implementation 'org.jetbrains:annotations:17.0.0'
Searching for it doesn't turn up any other examples of the problem. The only thing I can think of is proguard is renaming something it shouldn't. Since I can't manage to reproduce it (It's only happened to 5 users, but 26 times for them in all) in any emulator or using test devices, I can't test something like
-keep class androidx.appcompat.widget.** *;
which is all I can think to do.
android androidx android-jetpack
I migrated my app to androidx, and now in the released version, I'm getting that error. It works fine in all my tests, even the test lab doesn't find that error.
I've checked through every reference for it and they're all fine.
The line with the error:
private MaterialButton mShiftStartDate;
private void getVars()
.
mShiftStartDate = v.findViewById(R.id.shift_start_date_tv);
.
and the xml:
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:id="@id/shift_start_date_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textSize="18sp"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="@id/shift_start_date_label"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="@id/shift_start_date_label"
app:layout_constraintTop_toBottomOf="@id/shift_start_date_label"
tools:text="10/10/18" />
and parts of build.gradle
defaultConfig
applicationId appId
targetSdkVersion 28
minSdkVersion 19
versionCode buildCode
versionName versionMajor+"."+versionMinor+"."+versionRevision+"."+versionBuild
resValue "string", "CURRENT_VERSION", versionName
compileOptions
sourceCompatibility 1.8
targetCompatibility 1.8
dependencies
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha03'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'androidx.preference:preference:1.1.0-alpha04'
implementation 'androidx.annotation:annotation:1.1.0-alpha02'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'android.arch.navigation:navigation-fragment:1.0.0'
implementation 'android.arch.navigation:navigation-ui:1.0.0'
implementation 'com.google.android.gms:play-services-ads-lite:17.2.0'
implementation 'com.google.android.gms:play-services-oss-licenses:16.0.2'
implementation 'org.jetbrains:annotations:17.0.0'
Searching for it doesn't turn up any other examples of the problem. The only thing I can think of is proguard is renaming something it shouldn't. Since I can't manage to reproduce it (It's only happened to 5 users, but 26 times for them in all) in any emulator or using test devices, I can't test something like
-keep class androidx.appcompat.widget.** *;
which is all I can think to do.
android androidx android-jetpack
android androidx android-jetpack
asked Mar 26 at 22:41
useruser
104 bronze badges
104 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
you have a duplicate dependency there:
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
// implementation 'com.android.support:appcompat-v7:28.0.0'
and there is no widget N
. the ProGuard mapping might tell what it actually is.
-keep,includedescriptorclass class androidx.appcompat.widget.** *;
using stable versions might also help to sort out unexpected results.
I didn't catch that duplicate. thanks. I'm aware there's no widget "N", but with that being so, why is it trying to cast a non-existent widget to MaterialButton?
– user
Mar 26 at 22:58
@user unsure about that...includedescriptorclass
might help, as well as keepingR
(which appears likely for an obfuscated resource descriptor). add switch-verbose
to see about what it complains... it ordinary tells exactly what to do.
– Martin Zeitler
Mar 26 at 23:03
I'm wondering why this duplicate cause the problem ?!
– Ibrahim Ali
Mar 26 at 23:07
@IbrahimAli because the Jetifier will rewrite the name-space and each class must only exist once within a package, therefore it will result in a duplicate entry... however, the error message is related to classR
(most likely).
– Martin Zeitler
Mar 26 at 23:10
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%2f55367207%2fgetting-error-androidx-appcompat-widget-n-cannot-be-cast-to-com-google-android%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
you have a duplicate dependency there:
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
// implementation 'com.android.support:appcompat-v7:28.0.0'
and there is no widget N
. the ProGuard mapping might tell what it actually is.
-keep,includedescriptorclass class androidx.appcompat.widget.** *;
using stable versions might also help to sort out unexpected results.
I didn't catch that duplicate. thanks. I'm aware there's no widget "N", but with that being so, why is it trying to cast a non-existent widget to MaterialButton?
– user
Mar 26 at 22:58
@user unsure about that...includedescriptorclass
might help, as well as keepingR
(which appears likely for an obfuscated resource descriptor). add switch-verbose
to see about what it complains... it ordinary tells exactly what to do.
– Martin Zeitler
Mar 26 at 23:03
I'm wondering why this duplicate cause the problem ?!
– Ibrahim Ali
Mar 26 at 23:07
@IbrahimAli because the Jetifier will rewrite the name-space and each class must only exist once within a package, therefore it will result in a duplicate entry... however, the error message is related to classR
(most likely).
– Martin Zeitler
Mar 26 at 23:10
add a comment |
you have a duplicate dependency there:
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
// implementation 'com.android.support:appcompat-v7:28.0.0'
and there is no widget N
. the ProGuard mapping might tell what it actually is.
-keep,includedescriptorclass class androidx.appcompat.widget.** *;
using stable versions might also help to sort out unexpected results.
I didn't catch that duplicate. thanks. I'm aware there's no widget "N", but with that being so, why is it trying to cast a non-existent widget to MaterialButton?
– user
Mar 26 at 22:58
@user unsure about that...includedescriptorclass
might help, as well as keepingR
(which appears likely for an obfuscated resource descriptor). add switch-verbose
to see about what it complains... it ordinary tells exactly what to do.
– Martin Zeitler
Mar 26 at 23:03
I'm wondering why this duplicate cause the problem ?!
– Ibrahim Ali
Mar 26 at 23:07
@IbrahimAli because the Jetifier will rewrite the name-space and each class must only exist once within a package, therefore it will result in a duplicate entry... however, the error message is related to classR
(most likely).
– Martin Zeitler
Mar 26 at 23:10
add a comment |
you have a duplicate dependency there:
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
// implementation 'com.android.support:appcompat-v7:28.0.0'
and there is no widget N
. the ProGuard mapping might tell what it actually is.
-keep,includedescriptorclass class androidx.appcompat.widget.** *;
using stable versions might also help to sort out unexpected results.
you have a duplicate dependency there:
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
// implementation 'com.android.support:appcompat-v7:28.0.0'
and there is no widget N
. the ProGuard mapping might tell what it actually is.
-keep,includedescriptorclass class androidx.appcompat.widget.** *;
using stable versions might also help to sort out unexpected results.
edited Mar 26 at 23:00
answered Mar 26 at 22:53
Martin ZeitlerMartin Zeitler
24.1k5 gold badges52 silver badges88 bronze badges
24.1k5 gold badges52 silver badges88 bronze badges
I didn't catch that duplicate. thanks. I'm aware there's no widget "N", but with that being so, why is it trying to cast a non-existent widget to MaterialButton?
– user
Mar 26 at 22:58
@user unsure about that...includedescriptorclass
might help, as well as keepingR
(which appears likely for an obfuscated resource descriptor). add switch-verbose
to see about what it complains... it ordinary tells exactly what to do.
– Martin Zeitler
Mar 26 at 23:03
I'm wondering why this duplicate cause the problem ?!
– Ibrahim Ali
Mar 26 at 23:07
@IbrahimAli because the Jetifier will rewrite the name-space and each class must only exist once within a package, therefore it will result in a duplicate entry... however, the error message is related to classR
(most likely).
– Martin Zeitler
Mar 26 at 23:10
add a comment |
I didn't catch that duplicate. thanks. I'm aware there's no widget "N", but with that being so, why is it trying to cast a non-existent widget to MaterialButton?
– user
Mar 26 at 22:58
@user unsure about that...includedescriptorclass
might help, as well as keepingR
(which appears likely for an obfuscated resource descriptor). add switch-verbose
to see about what it complains... it ordinary tells exactly what to do.
– Martin Zeitler
Mar 26 at 23:03
I'm wondering why this duplicate cause the problem ?!
– Ibrahim Ali
Mar 26 at 23:07
@IbrahimAli because the Jetifier will rewrite the name-space and each class must only exist once within a package, therefore it will result in a duplicate entry... however, the error message is related to classR
(most likely).
– Martin Zeitler
Mar 26 at 23:10
I didn't catch that duplicate. thanks. I'm aware there's no widget "N", but with that being so, why is it trying to cast a non-existent widget to MaterialButton?
– user
Mar 26 at 22:58
I didn't catch that duplicate. thanks. I'm aware there's no widget "N", but with that being so, why is it trying to cast a non-existent widget to MaterialButton?
– user
Mar 26 at 22:58
@user unsure about that...
includedescriptorclass
might help, as well as keeping R
(which appears likely for an obfuscated resource descriptor). add switch -verbose
to see about what it complains... it ordinary tells exactly what to do.– Martin Zeitler
Mar 26 at 23:03
@user unsure about that...
includedescriptorclass
might help, as well as keeping R
(which appears likely for an obfuscated resource descriptor). add switch -verbose
to see about what it complains... it ordinary tells exactly what to do.– Martin Zeitler
Mar 26 at 23:03
I'm wondering why this duplicate cause the problem ?!
– Ibrahim Ali
Mar 26 at 23:07
I'm wondering why this duplicate cause the problem ?!
– Ibrahim Ali
Mar 26 at 23:07
@IbrahimAli because the Jetifier will rewrite the name-space and each class must only exist once within a package, therefore it will result in a duplicate entry... however, the error message is related to class
R
(most likely).– Martin Zeitler
Mar 26 at 23:10
@IbrahimAli because the Jetifier will rewrite the name-space and each class must only exist once within a package, therefore it will result in a duplicate entry... however, the error message is related to class
R
(most likely).– Martin Zeitler
Mar 26 at 23:10
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
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%2f55367207%2fgetting-error-androidx-appcompat-widget-n-cannot-be-cast-to-com-google-android%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