SwipeDelMenuLayout失效:Could not find SwipeDelMenuLayout-V1.3.0.jar

1. Problem description

        Recently, I came into contact with SwipeDelMenuLayout, a third-party Android development library, in a project at work, and then I configured it according to online tutorials. Let me talk about my development environment first: the Android Studio version is android-studio-2020.3.1.24-windows, and the gradle version is 7.0.2.

        The first is to add the jitpack warehouse in the settings.gradle file instead of the build.gradle file (the reason for this is to refer to other people's information: https://www.jdk5.com/ask/34/build-was-configured- to-prefer-settings-repositories-over-project-repositories-b ). This line of code added is

maven { url 'https://jitpack.io' }

        Then the whole settings.gradle file becomes

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}
rootProject.name = "SwipeDelDemo"
include ':app'

        Then add dependencies in the build.gradle (Module) file

implementation 'com.github.mcxtzhang:SwipeDelMenuLayout:V1.3.0'

        The dependencies of this file become as follows

dependencies {

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'


    implementation 'com.github.mcxtzhang:SwipeDelMenuLayout:V1.3.0'
}

        After that, you can compile and use the SwipeDelMenuLayout library. However, when compiling, I encountered a compilation error from Android Studio, saying

Could not find SwipeDelMenuLayout-V1.3.0.jar (com.github.mcxtzhang:SwipeDelMenuLayout:V1.3.0).

        Then I went to visit the address: https://jitpack.io/com/github/mcxtzhang/SwipeDelMenuLayout/V1.3.0/SwipeDelMenuLayout-V1.3.0.jar , and the browser displayed Build failed. See the log at jitpack.io. The specific error message is as follows:

        The above error indicates that the library cannot be referenced. I thought it was my configuration that was wrong, but following the configuration of others, Android Studio will report more compilation errors.

        if i delete

implementation 'com.github.mcxtzhang:SwipeDelMenuLayout:V1.3.0'

        In this way, the project is fine in an instant and can be run directly. Of course this is not the solution, haha.

Two, the solution

        I read the official documents back and forth several times, and then I made a major discovery! !

The version number recommended by the         open source author of the tripartite library on the CSDN blog is SwipeDelMenuLayout:V1.2.1, as shown in the figure:

        But in the readme.md document on GitHub, it says SwipeDelMenuLayout:V1.3.0, as shown in the figure:

        I believe that the author probably forgot to update the document in time, so there is a difference in the version number written in the call. In the end, when others referenced the library, some used V1.2.1 and some used V1.3.0. There should be no problem with these two version numbers, but recently (late July 2023), I guess that there may be a problem with the jitpack warehouse of the V1.3.0 version, which leads to the compilation error of the project. Reason for speculation: the author voluntarily revoked, or the warehouse was deleted.

        So, the final solution is: if you report an error with SwipeDelMenuLayout:V1.3.0, change it to SwipeDelMenuLayout:V1.2.1.

3. Effect after solution

        According to the above solution, referring to other people's sample code , the following side sliding deletion effect is obtained

        It feels good, very smooth.

4. References

        1. 【Android】Easiest in history, one-step integrated slide (delete) menu, high imitation QQ, IOS

        2、GitHub - mcxtzhang/SwipeDelMenuLayout

        3. The Android third-party control SwipeDelMenuLayout implements sliding deletion

        4、Build was configured to prefer settings repositories over project repositories

Guess you like

Origin blog.csdn.net/qq_36158230/article/details/131953617