Showcaseview NoClassDefFoundError

吃可爱长大的小学妹 提交于 2019-12-06 07:15:35

问题


I added showcaseview jar into my project and use it like this

    ShowcaseView.ConfigOptions co = new ShowcaseView.ConfigOptions();
    co.hideOnClickOutside = true;

    ViewTarget target = new ViewTarget(R.id.button_start_game, this);
    ShowcaseView sv = ShowcaseView.insertShowcaseView(target, this, R.string.showcase_main_title, R.string.showcase_main_message, co);
    sv.setOnShowcaseEventListener(this);

but I have exception

02-05 20:03:25.495: E/AndroidRuntime(25767): FATAL EXCEPTION: main
02-05 20:03:25.495: E/AndroidRuntime(25767): Process: com...., PID: 25767
02-05 20:03:25.495: E/AndroidRuntime(25767): java.lang.NoClassDefFoundError: com.github.espiandev.showcaseview.R$styleable
02-05 20:03:25.495: E/AndroidRuntime(25767):    at com.espian.showcaseview.ShowcaseView.<init>(ShowcaseView.java:105)
02-05 20:03:25.495: E/AndroidRuntime(25767):    at com.espian.showcaseview.ShowcaseView.<init>(ShowcaseView.java:97)
02-05 20:03:25.495: E/AndroidRuntime(25767):    at com.espian.showcaseview.ShowcaseView.insertShowcaseViewInternal(ShowcaseView.java:825)
02-05 20:03:25.495: E/AndroidRuntime(25767):    at com.espian.showcaseview.ShowcaseView.insertShowcaseView(ShowcaseView.java:854)
02-05 20:03:25.495: E/AndroidRuntime(25767):    at com...MainActivity.onCreate(MainActivity.java:82)

82 line has

ShowcaseView sv = ShowcaseView.insertShowcaseView(target, this, R.string.showcase_main_title, R.string.showcase_main_message, co);

What could be the problem?


回答1:


I'm a rookie Developer and I always seem to get stuck on things like this...

The solution is to not use a JAR, add the Showcaseview project as a library instead.

I solved this same issue by the following steps:

  1. Import "Main" project that is in the "library" folder into my workspace from https://github.com/amlcurran/ShowcaseView

  2. Right click the imported project from Step 1 and click properties>Android and check the "is library" box ![enter image description here][2]

  3. Right click the project you want to use Showcaseview in and click properties>Android and click "Add"
  4. Select the project from Step 1 and Click "OK" (Note: I have renamed mine to "Showcase" yours should be "Main" if you got the project from the Github link above)
  5. Click Apply
  6. Clean and Build

Enjoy less squiggly red lines!!!

I would post screen shots but this is my first SO post...




回答2:


I also got the same error. As because i haven't included nineoldandroid library. Just download this library from http://nineoldandroids.com/ and add this library to your Project. Your Error resolves surely



来源:https://stackoverflow.com/questions/21585302/showcaseview-noclassdeffounderror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!