etsy / AndroidStaggeredGrid

An Android staggered grid view which supports multiple columns with rows of varying sizes.
https://github.com/etsy/AndroidStaggeredGrid
4.76k stars 1.13k forks source link

Gradle Build in Android Studio #180

Open gitloko opened 9 years ago

gitloko commented 9 years ago

Hello, when i copy and paste these lines in android studio's gradle.build it tells me that it can't resolve it

repositories { mavenCentral() }

dependencies { compile 'com.etsy.android.grid:library:22.0.0' // read below comment }

wnafee commented 9 years ago

@lokmansahraoui There is no version 22.0.0 for this library If you look at the Change Log the latest is version 1.0.5

gitloko commented 9 years ago

thank you, i just figured all out by implementing the /library folder as a module on android studio, well when i call an object like : private StaggerdGridView mSGridView and then call it in my java from the layout with mSGridView = (StaggeredGridView) rootView.findViewById(R.id.grid_view);

Knowing that in my XML layout i added <com.etsy.android.grid.StaggeredGridView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/grid_view" android:layout_width="match_parent" android:layout_height="match_parent" app:item_margin="8dp" app:column_count="@integer/column_count" />

it tells me uknown app:item_margin and app:column_count in my package

wnafee commented 9 years ago

Make sure you copy over the attr.xml attributes file.

You should really consider just including the library dependency instead of copying over files to your project in a module. That way you can be up-to-date with any improvements to this library.

Just add this to your dependency instead compile 'com.etsy.android.grid:library:1.0.5'. It will save you a ton of hassle

gitloko commented 9 years ago

So i delete the imported module (/library) and add compile 'com.etsy.android.grid:library:1.0.5' in my app's Build.Gradle dependencies and that's it ?

wnafee commented 9 years ago

yes it's that simple :)

gitloko commented 9 years ago

:( same result as when i put 22.0.0 yesterday, i'm using the app:Build.gradle C:\Users\Lokman\AndroidStudioProjects\TryOuts\app\build.gradle Error:(26, 13) Failed to resolve: com.etsy.android.grid:library:1.0.5 Show in File Show in Project Structure dialog

gitloko commented 9 years ago

at LAst ! :D ! the problem was in my android studio beacause of the update the offline mode was activated, it was like i hadn't internet connection :)

just went to File/Settings/Gradle...; and then unchecked offline mode

Neha--Agarwal commented 6 years ago

I am facing the same problem. None of the solutions are working for me. Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.etsy.android.grid:library:1.0.5.