gpt4 book ai didi

android - Gradle 项目同步在使用来自 GitHub 的库时失败

转载 作者:行者123 更新时间:2023-12-03 05:54:25 26 4
gpt4 key购买 nike

我正在尝试使用 SwipeLayout来自 GitHub 的库,但我收到此错误:

Failed to resolve: com.daimajia.swipelayout:library:1.2.0

我尝试了一切,包括:
  • 已删除 @aar
  • ProjectStructure -> app -> Dependencies 搜索和添加库

  • 等等..

    首先我可能是这个库的问题,但我尝试使用 this one但仍然出现该错误..如果有人能给我一个线索,我将不胜感激。你能解释一下 compile ' 之间有什么区别吗?和 compile "我都试过了

    *这是我的 * `build.gradle' 文件:
    apply plugin: 'com.android.application'

    android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
    applicationId "com.drgnme.listhamrah"
    minSdkVersion 23
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
    release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    }
    }

    dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
    compile 'com.android.support:cardview-v7:26.0.0-alpha1'
    compile 'com.android.support:design:26.0.0-alpha1'
    compile 'com.github.roojin:persian-calendar-view:1.2.1'
    compile 'com.android.support:support-v4:26.0.0-alpha1'
    compile "com.daimajia.swipelayout:library:1.2.0@aar"
    }

    最佳答案

    只需像这样尝试:

     <android.support.v4.widget.SwipeRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/swipe_refresh_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
    android:id="@+id/study_level_list"
    android:scrollbars="vertical"
    android:paddingBottom="85dp"
    android:clipToPadding="false"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    </android.support.v7.widget.RecyclerView>
    </android.support.v4.widget.SwipeRefreshLayout>

    在 Java 文件中;
    private SwipeRefreshLayout mSwipeRefreshLayout;

    mSwipeRefreshLayout = (SwipeRefreshLayout)rootView. findViewById(R.id.swipe_refresh_layout);

    并像这样绑定(bind)您的 ListView ;
     mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
    @Override
    public void onRefresh() {
    // Refresh the data
    // Calls setRefreshing(false) when it is finish
    mAdapter = new MyAdapter(studypojo.getStudylevelList());
    list_view.setAdapter(mAdapter);
    mSwipeRefreshLayout.setRefreshing(false);
    }
    });

    关于android - Gradle 项目同步在使用来自 GitHub 的库时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45854248/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com