Android Showcaseview库java.lang.NoClassDefFoundError

时间:2014-01-26 14:46:14

标签: android

当我编译我的应用程序时

我有这个错误..

我该如何解决?

01-26 23:27:33.392:E / AndroidRuntime(18895):java.lang.NoClassDefFoundError:com.espian.showcaseview.ShowcaseView $ ConfigOptions

我的代码

ShowcaseView sv;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ShowcaseView.ConfigOptions co = new ShowcaseView.ConfigOptions();
    co.hideOnClickOutside = true;
    ViewTarget target = new ViewTarget(R.id.test, this);
    sv = ShowcaseView.insertShowcaseView(target, this, R.string.showcase_main_title, R.string.showcase_main_message, co);
    sv.setOnShowcaseEventListener(this);
}

@Override
public void onShowcaseViewHide(ShowcaseView showcaseView) {
    // TODO Auto-generated method stub

}

@Override
public void onShowcaseViewDidHide(ShowcaseView showcaseView) {
    // TODO Auto-generated method stub

}

@Override
public void onShowcaseViewShow(ShowcaseView showcaseView) {
    // TODO Auto-generated method stub

}

1 个答案:

答案 0 :(得分:1)

请确保 ShowCaseView 类具有静态类 ConfigOptions

public static class ConfigOptions {

    public boolean block = true, noButton = false;
    public boolean hideOnClickOutside = false;

    /**
     * Does not work with the {@link ShowcaseViews} class as it does not make sense (only with
     * {@link ShowcaseView}).
     * @deprecated not compatible with Target API
     */
    @Deprecated
    public int insert = INSERT_TO_DECOR;

    /**
     * If you want to use more than one Showcase with the {@link ConfigOptions#shotType} {@link
     * ShowcaseView#TYPE_ONE_SHOT} in one Activity, set a unique value for every different
     * Showcase you want to use.
     */
    public int showcaseId = 0;

    /**
     * If you want to use more than one Showcase with {@link ShowcaseView#TYPE_ONE_SHOT} in one
     * Activity, set a unique {@link ConfigOptions#showcaseId} value for every different
     * Showcase you want to use. If you want to use this in the {@link ShowcaseViews} class, you
     * need to set a custom showcaseId for each {@link ShowcaseView}.
     */
    public int shotType = TYPE_NO_LIMIT;

    /**
     * Default duration for fade in animation. Set to 0 to disable.
     */
    public int fadeInDuration = AnimationUtils.DEFAULT_DURATION;

    /**
     * Default duration for fade out animation. Set to 0 to disable.
     */
    public int fadeOutDuration = AnimationUtils.DEFAULT_DURATION;
    /**
     * Allow custom positioning of the button within the showcase view.
     */
    public LayoutParams buttonLayoutParams = null;

    /**
     * Whether the text should be centered or stretched in the available space
     */
    public boolean centerText = false;
}