2017-08-24 99 views
0
库失败

我试图使用SwipeLayout库从GitHub但我得到这个错误:摇篮工程同步使用从GitHub

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

我什么都试过,包括:

  • 删除@aar
  • 搜索并添加库从ProjectStructure -> app -> Dependencies

等..

第一我虽然也许问题是这样的库,但我试图用this one但仍然收到这个错误..如果任何人都可以给我一个线索,我会如此感激。 和u能解释什么是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:[email protected]" 
} 
+0

发布你的gradle文件。 – Abhi

+0

确保您有良好的互联网连接以下载该库所需的所有文件。在某些情况下,如果端口未打开,android studio将无法同步导入的库。我试着用你提到的库,它对我来说工作正常..! – gStephin

+0

@stephingeorge真的为你工作吗?是的,我做了你所说的,我甚至尝试这样做:'无效缓存/重新启动',但仍然失败:(( –

回答

0

简单地尝试这样的:

<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> 

in Java File;

private SwipeRefreshLayout mSwipeRefreshLayout; 

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

并绑定你的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); 
     } 
    }); 
+0

不错..是一个好主意 –

0

作者没有说明,但在检查项目文件后,似乎他将工件部署到中央(AKA maven central)。因此,将mavenCentral()添加到您的资源库列表中,您应该得到该工件。或者,您可以使用jitpack存储库。