问题
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:
Import "Main" project that is in the "library" folder into my workspace from https://github.com/amlcurran/ShowcaseView
Right click the imported project from Step 1 and click properties>Android and check the "is library" box ![enter image description here][2]
- Right click the project you want to use Showcaseview in and click properties>Android and click "Add"
- 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)
- Click Apply
- 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