java.lang.NoClassDefFoundError: android/support/v4/app/NotificationCompat$Builder
I know this error is resolved by adding private libraries to project, but in my case if I add private libraries then I am getting different error:
Unable to execute dex: Multiple dex files define
And the fix for above was removing private libraries which I found here
So any better solution???
My code:
private void check() {
NotificationCompat.Builder builder = new NotificationCompat.Builder(
getApplicationContext());
Notification notification = builder.setSmallIcon(R.drawable.icon)
.setContentTitle("New notification")
.setContentText("Hello world!").build();
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(1, notification);
}
My project build path :