Android Sweet Alert Dialog依赖项

时间:2015-03-22 15:17:27

标签: android github gradle

我阅读了Sweet AlertDialog教程,并以这种方式为项目添加了依赖项:

  1. 选择Build.Gradle(模块:应用)并打开

  2. 转到这一行:

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
    }
    

    并改为:

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'cn.pedant.sweetalert:library:1.3'
    }
    
  3. 运行我的app.but我收到此错误:

    Error:A problem occurred configuring project ':app'.
    > Could not resolve all dependencies for configuration ':app:_debugCompile'.
       > Could not find com.android.support:appcompat-v7:21.0.0.
         Searched in the following locations:
             https://jcenter.bintray.com/com/android/support/appcompat-v7/21.0.0/appcompat-v7-21.0.0.pom
             https://jcenter.bintray.com/com/android/support/appcompat-v7/21.0.0/appcompat-v7-21.0.0.jar
             file:/D:/sdk/ADT-Bundle-Windows-x86-20140702.Full_p30download.com/sdk/extras/android/m2repository/com/android/support/appcompat-v7/21.0.0/appcompat-v7-21.0.0.pom
             file:/D:/sdk/ADT-Bundle-Windows-x86-20140702.Full_p30download.com/sdk/extras/android/m2repository/com/android/support/appcompat-v7/21.0.0/appcompat-v7-21.0.0.jar
             file:/D:/sdk/ADT-Bundle-Windows-x86-20140702.Full_p30download.com/sdk/extras/google/m2repository/com/android/support/appcompat-v7/21.0.0/appcompat-v7-21.0.0.pom
             file:/D:/sdk/ADT-Bundle-Windows-x86-20140702.Full_p30download.com/sdk/extras/google/m2repository/com/android/support/appcompat-v7/21.0.0/appcompat-v7-21.0.0.jar
         Required by:
             MyApplication:app:unspecified > cn.pedant.sweetalert:library:1.3 > com.pnikosis:materialish-progress:1.0
    
  4. 当我添加appcompat-v7-21.0.0.jar时,我收到此错误:

    Error:Failed to find: com.android.support:appcompat-v7:21.0.0
    <a href="openFile">Open File</a><br><a href="open.dependency.in.project.structure">Open in Project Structure dialog</a>
    

2 个答案:

答案 0 :(得分:0)

首先删除appcompat-v7-21.0.0.jar,然后尝试使用以下内容替换您的依赖项:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'cn.pedant.sweetalert:library:1.3'
}

答案 1 :(得分:0)

如果是缺少支持库的情况,我认为您需要从

下载 Android支持存储库

Android SDK Manager-&gt; SDK工具 - &gt;支持存储库 - &gt; Android支持存储库。