Search code examples
androidxmlmavengithub

Cannot resolve class error when using library from GitHub


I want to use this library: https://github.com/rongi/rotate-layout

However I get the following errors when I use the code below in my project:

Class referenced in the layout file, com.github.rongi.rotate_layout.layout.RotateLayout, was not found in the project or the libraries
Cannot resolve class com.github.rongi.rotate_layout.layout.RotateLayout 

I used implementation ("rongi.rotate-layout:rotate-layout:3.0.0") and implementation ("com.github.rongi.rotate-layout:rotate-layout:3.0.0")

<com.github.rongi.rotate_layout.layout.RotateLayout
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:angle="90"> <!-- Specify rotate angle here -->

Screenshot


Solution

  • The library is quite old and wasn't migrated to the Maven Central repository, since JCenter was deprecated.

    But you can use it from Jitpack repository:

    1. Add it in your root build.gradle at the end of repositories:
    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }
    
    1. Add the dependency to your app build.gradle:
    dependencies {
        implementation 'com.github.rongi:rotate-layout:v3.0.0'
    }