I am trying to show snackbar when my fragment view is inflated. I have written the snackbar code in onViewCreated, it works and shows me the snackbar. But when I am trying to setAction and set onClickListener the Build gradle fails. I am attaching the code snippet and error log.
FragmentContact.java
public void onViewCreated(View v, Bundle savedInstanceState) {
Snackbar.make(getActivity().findViewById(android.R.id.content), "Doubt?", Snackbar.LENGTH_LONG)
.setAction("Call",new View.OnClickListener(){
@Override
public void onClick(View v) {
}
})
.show();
Error Log
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0\bin\java.exe'' finished with non-zero exit value 2
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 44.306 secs
Dependencies in gradle
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.android.support:support-v4:23.1.0'
compile "com.android.support:support-v4:+"
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5@aar'
}