我正在尝试实现BottomSheet Library。我已按照说明操作,但当我尝试打开Bottosheet菜单时,我的应用程序崩溃了。
我的Java代码实现BottomSheet如下所示
findViewById(R.id.butShare).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new BottomSheet.Builder(QuoteViewActivity.this).title("title").sheet(R.menu.menu).listener(new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case R.id.help:
//q.toast("Help me!");
break;
}
}
}).show();
}
});
和菜单XML如下所示
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/share" android:title="@string/facebook" android:icon="@drawable/new_facebook_page"/>
<item android:id="@+id/upload" android:title="@string/twitter" android:icon="@drawable/new_facebook_page"/>
<item android:id="@+id/call" android:title="@string/image" android:icon="@drawable/new_facebook_page"/>
<group android:id="@+id/helpgroup">
<item android:id="@+id/help" android:title="@string/whatsapp" android:icon="@drawable/new_facebook_page"/>
</group>
我的logCat就在下面
06-29 16:26:48.267: E/AndroidRuntime(6856): FATAL EXCEPTION: main
06-29 16:26:48.267: E/AndroidRuntime(6856): Process: com.vmapps.quotesking, PID: 6856
06-29 16:26:48.267: E/AndroidRuntime(6856): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/cocosw/bottomsheet/R$styleable;
06-29 16:26:48.267: E/AndroidRuntime(6856): at com.cocosw.bottomsheet.BottomSheet.<init>(BottomSheet.java:103)
06-29 16:26:48.267: E/AndroidRuntime(6856): at com.cocosw.bottomsheet.BottomSheet$Builder.build(BottomSheet.java:710)
06-29 16:26:48.267: E/AndroidRuntime(6856): at com.cocosw.bottomsheet.BottomSheet$Builder.show(BottomSheet.java:675)
06-29 16:26:48.267: E/AndroidRuntime(6856): at com.vmapps.quotesking.material.QuoteViewActivity$4.onClick(QuoteViewActivity.java:185)
06-29 16:26:48.267: E/AndroidRuntime(6856): at android.view.View.performClick(View.java:5076)
06-29 16:26:48.267: E/AndroidRuntime(6856): at android.view.View$PerformClick.run(View.java:20279)
06-29 16:26:48.267: E/AndroidRuntime(6856): at android.os.Handler.handleCallback(Handler.java:739)
06-29 16:26:48.267: E/AndroidRuntime(6856): at android.os.Handler.dispatchMessage(Handler.java:95)
06-29 16:26:48.267: E/AndroidRuntime(6856): at android.os.Looper.loop(Looper.java:135)
06-29 16:26:48.267: E/AndroidRuntime(6856): at android.app.ActivityThread.main(ActivityThread.java:5930)
06-29 16:26:48.267: E/AndroidRuntime(6856): at java.lang.reflect.Method.invoke(Native Method)
06-29 16:26:48.267: E/AndroidRuntime(6856): at java.lang.reflect.Method.invoke(Method.java:372)
06-29 16:26:48.267: E/AndroidRuntime(6856): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
06-29 16:26:48.267: E/AndroidRuntime(6856): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
06-29 16:26:48.267: E/AndroidRuntime(6856): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.cocosw.bottomsheet.R$styleable" on path: DexPathList[[zip file "/data/app/com.vmapps.quotesking-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
06-29 16:26:48.267: E/AndroidRuntime(6856): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
06-29 16:26:48.267: E/AndroidRuntime(6856): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
06-29 16:26:48.267: E/AndroidRuntime(6856): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
06-29 16:26:48.267: E/AndroidRuntime(6856): ... 14 more
06-29 16:26:48.267: E/AndroidRuntime(6856): Suppressed: java.lang.ClassNotFoundException: com.cocosw.bottomsheet.R$styleable
06-29 16:26:48.267: E/AndroidRuntime(6856): at java.lang.Class.classForName(Native Method)
06-29 16:26:48.267: E/AndroidRuntime(6856): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
06-29 16:26:48.267: E/AndroidRuntime(6856): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
06-29 16:26:48.267: E/AndroidRuntime(6856): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
06-29 16:26:48.267: E/AndroidRuntime(6856): ... 15 more
06-29 16:26:48.267: E/AndroidRuntime(6856): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
由于