AndroidStaggeredGrid icon indicating copy to clipboard operation
AndroidStaggeredGrid copied to clipboard

java.lang.NoClassDefFoundError: com.etsy.android.grid.R$styleable

Open ismaeltoe opened this issue 12 years ago • 8 comments

Trying to execute your sample app, When I click on "Staggered Grid View" button I get this error:

01-23 12:10:22.546: E/AndroidRuntime(26874): FATAL EXCEPTION: main 01-23 12:10:22.546: E/AndroidRuntime(26874): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.etsy.android.sample/com.etsy.android.sample.StaggeredGridActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class com.etsy.android.grid.StaggeredGridView 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.os.Handler.dispatchMessage(Handler.java:99) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.os.Looper.loop(Looper.java:130) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.ActivityThread.main(ActivityThread.java:3687) 01-23 12:10:22.546: E/AndroidRuntime(26874): at java.lang.reflect.Method.invokeNative(Native Method) 01-23 12:10:22.546: E/AndroidRuntime(26874): at java.lang.reflect.Method.invoke(Method.java:507) 01-23 12:10:22.546: E/AndroidRuntime(26874): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 01-23 12:10:22.546: E/AndroidRuntime(26874): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 01-23 12:10:22.546: E/AndroidRuntime(26874): at dalvik.system.NativeStart.main(Native Method) 01-23 12:10:22.546: E/AndroidRuntime(26874): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class com.etsy.android.grid.StaggeredGridView 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.createView(LayoutInflater.java:518) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.inflate(LayoutInflater.java:408) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 01-23 12:10:22.546: E/AndroidRuntime(26874): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:216) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.Activity.setContentView(Activity.java:1660) 01-23 12:10:22.546: E/AndroidRuntime(26874): at com.etsy.android.sample.StaggeredGridActivity.onCreate(StaggeredGridActivity.java:31) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615) 01-23 12:10:22.546: E/AndroidRuntime(26874): ... 11 more 01-23 12:10:22.546: E/AndroidRuntime(26874): Caused by: java.lang.reflect.InvocationTargetException 01-23 12:10:22.546: E/AndroidRuntime(26874): at java.lang.reflect.Constructor.constructNative(Native Method) 01-23 12:10:22.546: E/AndroidRuntime(26874): at java.lang.reflect.Constructor.newInstance(Constructor.java:415) 01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.createView(LayoutInflater.java:505) 01-23 12:10:22.546: E/AndroidRuntime(26874): ... 21 more 01-23 12:10:22.546: E/AndroidRuntime(26874): Caused by: java.lang.NoClassDefFoundError: com.etsy.android.grid.R$styleable 01-23 12:10:22.546: E/AndroidRuntime(26874): at com.etsy.android.grid.StaggeredGridView.(StaggeredGridView.java:153) 01-23 12:10:22.546: E/AndroidRuntime(26874): at com.etsy.android.grid.StaggeredGridView.(StaggeredGridView.java:145)

ismaeltoe avatar Jan 23 '14 12:01 ismaeltoe

Hi, I too get the same error with the same log, is there any workaround to this?? Or is there anything that i could be missing? Please assist.

Thanks

ghost avatar Mar 31 '14 08:03 ghost

This is odd - you are building the sample with Android Studio and Gradle?

denizmveli avatar Apr 06 '14 17:04 denizmveli

@denizmveli No with Eclipse

ismaeltoe avatar Apr 08 '14 01:04 ismaeltoe

Hi, I also got same error with same log.Please suggest me any way to solve this problem.Thanks in advance.

juliepatel avatar May 07 '14 10:05 juliepatel

I found a solution. 1.First Import the library to eclipse. 2. Right click the library and go to android tools. From their click Add support library 3.Now go to your_library_project > libs folder 4.Right click on the support library and go to build path and click add to build path.

Now run your application .. it should run without error

fazlerabbitanjil avatar May 08 '14 06:05 fazlerabbitanjil

Got the same error, and @cybertanz's solution doesn't work.

cnevinc avatar May 28 '14 07:05 cnevinc

Do not copy the .jar file directly into the libs folder. if you have already have then try deleting it. If deleting encounters a problem, just restart eclipse and then delete it. After that import the project as a library.

  1. right click on your project.
  2. go to properties and android.
  3. in the bottom click on Add and then select the project.
  4. apply.
  5. both the project should be in the same workspace.
  6. don't directly copy the project in the workspace import it form another location and then click on copy project in workspace.

shreyanshjain avatar Jun 10 '14 13:06 shreyanshjain

@cybertanz solution works.

akuttyd avatar Oct 11 '14 06:10 akuttyd