0

I want to create application using Fresco library with zoom functionality using ZoomableDraweeView but when I start my application, application got crashed. Below is my code so please help me to solve this issue and thanks in advance.

public class ZoomActivity extends Activity {

    private ZoomableDraweeView view;
    private DraweeController ctrl;
    private GenericDraweeHierarchy hierarchy;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        Fresco.initialize(this);
        setContentView(R.layout.activity_zoom);

        Uri imageUri = Uri.parse("http://i.imgur.com/76Jfv9b.jpg");
        view = (ZoomableDraweeView) findViewById(R.id.zoomable);

        ctrl = Fresco.newDraweeControllerBuilder().setUri(imageUri).setTapToRetryEnabled(true).build();
        hierarchy = new GenericDraweeHierarchyBuilder(getResources())
                .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
                .setProgressBarImage(new ProgressBarDrawable())
                .build();
        view.setController(ctrl);
        view.setHierarchy(hierarchy);
    }
}

Here is my layout.

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.android.imageloaderexample.Activity.Fresco.ZoomActivity">

    <com.facebook.samples.zoomable.ZoomableDraweeView
        android:id="@+id/zoomable"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</RelativeLayout>

Here is Gradle.

    apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.android.imageloaderexample"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile files('libs/picasso-2.5.2.jar')
    compile files('libs/universal-image-loader-1.9.5.jar')
    compile files('libs/glide-3.6.1.jar')
    compile 'com.facebook.fresco:fresco:0.10.0'
    compile 'com.facebook.fresco:animated-gif:0.10.0'
    compile "com.facebook.fresco:imagepipeline-okhttp:0.10.0+"
}

Below is my logcate.

    FATAL EXCEPTION:  Process: com.example.android.imageloaderexample, PID: 
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.imageloaderexample/com.example.android.imageloaderexample.Activity.Fresco.ZoomActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class com.facebook.samples.zoomable.ZoomableDraweeView

at java.lang.ClassLoader.loadClass(ClassLoader.java:504)... 23 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack availableBB
Mohd Sakib Syed
  • 1,679
  • 1
  • 25
  • 42

1 Answers1

1
 <com.example.android.imageloaderexample.Activity.ZoomableDraweeView
    android:id="@+id/zoomable"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

Please add this Code It is working for me and Enjoy .. . !!

Akshay More
  • 359
  • 2
  • 13