score:100
EDIT:
The solution that worked for me was (Using Proguard) to replace this:
-keep class android.support.v4.** { *; }
-keep interface android.support.v4.** { *; }
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }
with this:
# Allow obfuscation of android.support.v7.internal.view.menu.**
# to avoid problem on Samsung 4.2.2 devices with appcompat v21
# see https://code.google.com/p/android/issues/detail?id=78377
-keep class !android.support.v7.internal.view.menu.**,android.support.** {*;}
Credit goes to the google group, #138.
Old answer (Temporary Workaround):
It happens in a project where I use an spinner in the ActionBar. My solution was to check for those conditions and change the app flow:
public static boolean isSamsung_4_2_2() {
String deviceMan = Build.MANUFACTURER;
String deviceRel = Build.VERSION.RELEASE;
return "samsung".equalsIgnoreCase(deviceMan) && deviceRel.startsWith("4.2.2");
}
Then in the activity's onCreate method:
if (isSamsung_4_2_2()) {
setContentView(R.layout.activity_main_no_toolbar);
} else {
setContentView(R.layout.activity_main);
}
As pointed out this is not a definitive solution, it is just a way to allow users to have access to limited functionality while a more permanent solution is found.
score:-4
Change the Compile Sdk Version of your project to "API 18:(JellyBean)"
The default is set to "Lollipop
STEPS
- Right Click on your project and select Open Module Settings (or press F4)
- In the properties tab Compiled Sdk Version
score:0
I enabled proguard with the default proguard properties provided with an eclipse project and the problem was fixed for me. Based on some comments here https://code.google.com/p/android/issues/detail?id=78377 , some people might have to repackage using: -repackageclasses "android.support.v7"
score:0
I got the same error when trying to run a 'Hello World' app on my Samsung Galaxy Tab 3 tablet via Android Studio. The app would appear to launch and then it would crash instantly and that error would show in the console in Android Studio. I did a system update on the tablet and now I am able to run the 'Hello World' app and I'm not getting the error anymore. I hope this helps someone to resolve their issue.
Note: The system update I performed on the tablet did not update the Android OS version, because it still says that the version is 4.2.2.
score:4
score:4
I was having the same problem of this MenuBuilder class not found in USB debugging mode. I solved this problem by simply setting the minifyEnabled to true in both release and debug buildTypes block of build.gradle . like this:
buildTypes {
debug {
minifyEnabled true
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
I set the minifyEnabled to true in debug type to prevent app from crashing via USB debugging to a live handset.
score:12
According to the last posts of the bug-report, this should be fixed on the new version of the support library (24.0.0) : https://code.google.com/p/android/issues/detail?id=78377#c374
Someone even claimed it fixed it.
This version is available since last month, so you should update to it.
score:15
This issue returned in AppCompat 23.1.1
where the .internal
package was removed from the library jar.
As suggested in the comments above (credits to the people who suggested it there), now also the proguard configuration has to change.
To get the answer suggested above working again, try adding these lines to your proguard files:
#FOR APPCOMPAT 23.1.1:
-keep class !android.support.v7.view.menu.*MenuBuilder*, android.support.v7.** { *; }
-keep interface android.support.v7.* { *; }
In stead of the old fix:
#FOR OLDER APPCOMPAT VERSION:
-keep class !android.support.v7.internal.view.menu.*MenuBuilder, android.support.v7.** { ; }
-keep interface android.support.v7.* { *; }
score:23
On which device you are facing this problem ? (Samsung/HTC etc.)
If it is Samsung,
Various Samsung phones are included older versions of the android support library in the framework or classpath. If you use the new material support library, you'll see this crash on those Samsung devices:
java.lang.NoClassDefFoundError: android.support.v7.internal.view.menu.MenuBuilder
To fix this, you must rename that class. Easiest way to do that is by running proguard. If you don't want to obfuscate, here's a 1 liner to rename just the offending classes:
-keep class !android.support.v7.internal.view.menu.**,** {*;}
There's an issue tracking this problem, but since it's really a Samsung bug, it's never going to get fixed on their end. Only way to fix it on the Google/AOSP side is to rename these internal classes.
score:26
As #150 from google groups said
Because careful with -keep class !android.support.v7.internal.view.menu.**. There are a number of classes in there which are referenced from the appcompat's resources.
The better solution is add the following lines instead:
-keep class !android.support.v7.internal.view.menu.*MenuBuilder*, android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }
Source: stackoverflow.com
Related Query
- NoClassDefFoundError - Eclipse and Android
- How do I attach the Android Support Library source in Eclipse?
- Setting up Android support package v7 for eclipse - GridLayout
- Eclipse with Android SDK missing menu items
- How to remove native support from an Android Project in eclipse because eclipse is showing errors in jni?
- Adding Support Libraries to Android project
- Opening source code from debug view edits .class after Android R18 update
- How to use Legacy Apache in Eclipse in order to support Android M
- NoClassDefFoundError on external library project for Android
- How to view SQL database in Eclipse Debug mode for android
- Android multidex support library using eclipse
- Error using Android Design Support Library: attr backgroundTint not found
- Android Eclipse NoClassDefFoundError for external .jar files
- Align Center Menu Item text in android
- Android eclipse startManagingCursor Deprecated but want to support older API versions?
- How to create n project with ADT r20 without including the android support library?
- Android - How can I view a sql database created in my app? I'm running it on the Android emulator in Eclipse
- How to add an OnClick event for an Android custom View
- Enabling MultiDex Support in Android to achieve 65K+ methods in Eclipse
- How do I view Android LogCat output from an exported APK running on a physical device?
- Android DDMS view not available in Eclipse Juno
- why I cannot use "run Android lint" from menu "Window" in Eclipse in toolbar I can run it, is it OK?
- Increasing the visibility of a view on Swipe using Gestures in android
- android wear - eclipse : not recognizing support library
- Display view in Eclipse menu Window-> Show View
- while using support library i am getting an error that Attribute " " has already been defined in android
- Eclipse wont recognize Android support library revision 9
- Android Lint: How to suppress all warnings associated with support library?
- Android Studio not detecting support libraries on Compilation
- Eclipse + Android + JUnit test references android.os class = NoClassDefFoundError
More Query from same tag
- XText development in eclipse
- How to add lib into modules in wildfly 8.2 Final?
- How to prevent Eclipse from creating fragment_main.xml
- How to access GWT designer view on eclipse
- Eclipse multiple projects to view as one in project explorer
- How can I center two textviews in RelativeLayout
- How to run with old version of Junit 4 in Eclipse (Galileo)
- Eclipse NoClassDefFoundError
- In Eclipse, where do you find the option to automatically include chosen static imports?
- Maven projects disappeared from project explorer in Eclipse
- Java Thread catching all Exceptions?
- Cannot import google cloud endpoints client library class in Android project
- Double installation of apk
- To find an execution line-counter for Java IDE
- 16 Thread / 16 core code profiling with Java / Eclipse TPTP on Linux system
- Fix N Crash (i cant Fix it or it will crash) Loop and Break in java
- Can not use android phone as emulator in eclipse
- ClassNotFoundException when launching junit tests in Eclipse 2019-12 on Windows when using Java 9+
- Eclipse Neon Does Not Start
- hibernate.cfg.xml not found on the JBoss server on OpenShift
- import java.awt.Desktop is not resolved in Eclipse
- Importing project from github to eclipse error
- On Eclipse Console view, what key(s) move the focus to the button row?
- How can I find tests that haven't been added to a particular test suite?
- java generics compiles in eclipse and not from commandline
- Eclipse - New Gradle project with Spock and Groovy
- Warning message running Play - activator eclipse
- "git pull --rebase" in Eclipse
- How can I view the html source of a response webpage rendered inside Eclipse?
- Android @Override issues