2016-05-12 13 views
0

Ich möchte Anwendung erstellen mit Fresco Bibliothek mit Zoom-Funktionalität mit ZoomableDraweeView aber wenn ich meine Anwendung starten, wurde die Anwendung abgestürzt. Unten ist mein Code, bitte hilf mir, dieses Problem zu lösen und danke im Voraus.Android Fresco: Fehler beim Aufblasen Klasse com.facebook.samples.zoomable.ZoomableDraweeView

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); 
    } 
} 

Hier ist mein 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> 

Hier ist 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+" 
} 

Unten ist meine 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 
+0

Können Sie eine Stack-Trace bereitstellen? –

Antwort

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

Bitte fügen Sie diesen Code Es ist für mich arbeiten und genießen ... !!

Verwandte Themen