2015-05-04 75 views
1

我想添加這個library但是當我嘗試同步搖籃編譯器給我這個錯誤:Android的搖籃同步異常,並順利進度欄項目

Error:(6, 13) Failed to resolve: com.github.castorflex.smoothprogressbar:library:1.1.0

如果這個問題解決了這個問題,我在我的項目中發佈的堆棧溢出中有this其他問題。

這是它的外觀我的項目結構:

enter image description here

而這是所有項目的build.grade文件

主要整經機項目(guestperience 1.0.1蒙克洛亞德聖拉薩羅):

// Top-level build file where you can add configuration options common to all sub-projects/modules. 
buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:1.2.0' 
    } 
} 

goSmart.guestperience.MoncloaDeSanLazaro(這是我代碼):

apply plugin: 'com.android.application' 

dependencies { 
    compile fileTree(dir: 'libs', include: '*.jar') 
    compile project(':librarySmartHotel') 
    compile 'com.google.android.gms:play-services:7.3.0' 
    compile 'com.github.castorflex.smoothprogressbar:library:1.1.0' 
} 

android { 
    compileSdkVersion 16 
    buildToolsVersion "22.0.1" 

    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src'] 
      resources.srcDirs = ['src'] 
      aidl.srcDirs = ['src'] 
      renderscript.srcDirs = ['src'] 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['assets'] 
     } 

     // Move the tests to tests/java, tests/res, etc... 
     instrumentTest.setRoot('tests') 

     // Move the build types to build-types/<type> 
     // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 
     // This moves them out of them default location under src/<type>/... which would 
     // conflict with src/ being used by the main source set. 
     // Adding new build types or product flavors should be accompanied 
     // by a similar customization. 
     debug.setRoot('build-types/debug') 
     release.setRoot('build-types/release') 
    } 
} 

librarySmartHotel:

apply plugin: 'com.android.library' 

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

android { 
    compileSdkVersion 16 
    buildToolsVersion '22.0.1' 

    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src'] 
      resources.srcDirs = ['src'] 
      aidl.srcDirs = ['src'] 
      renderscript.srcDirs = ['src'] 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['assets'] 
     } 

     // Move the tests to tests/java, tests/res, etc... 
     instrumentTest.setRoot('tests') 

     // Move the build types to build-types/<type> 
     // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 
     // This moves them out of them default location under src/<type>/... which would 
     // conflict with src/ being used by the main source set. 
     // Adding new build types or product flavors should be accompanied 
     // by a similar customization. 
     debug.setRoot('build-types/debug') 
     release.setRoot('build-types/release') 
    } 
} 

主:

apply plugin: 'com.android.library' 

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

android { 
    compileSdkVersion 16 
    buildToolsVersion '22.0.1' 

    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src'] 
      resources.srcDirs = ['src'] 
      aidl.srcDirs = ['src'] 
      renderscript.srcDirs = ['src'] 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['assets'] 
     } 

     // Move the tests to tests/java, tests/res, etc... 
     instrumentTest.setRoot('tests') 

     // Move the build types to build-types/<type> 
     // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 
     // This moves them out of them default location under src/<type>/... which would 
     // conflict with src/ being used by the main source set. 
     // Adding new build types or product flavors should be accompanied 
     // by a similar customization. 
     debug.setRoot('build-types/debug') 
     release.setRoot('build-types/release') 
    } 
} 

我在想,有些配置丟失(也許),真正是我超級丟失。

唯一能想到的是該庫甚至不在External Libraries部分下載。

UPDATE:

我可以看到,東西在我的Android工作室全球性的,我不能夠從另一個數據存儲庫添加任何東西。

回答

0

你只需要在文件的開頭補充一點:

repositories { 
    mavenCentral() 
} 

你也可能有「離線模式」已啓用。

檢查是否啓用文件 - >構建,執行,部署 - > Maven/Gradle「離線工作」,如果是這樣,只需將其禁用並同步Gradle。

這就是全部。

而在我的情況下,我也加入了這一點,因爲播放服務:

應用插件:「com.android.application」

defaultConfig { 
    multiDexEnabled true 
} 

你會用這樣的文件結束

repositories { 
    mavenCentral() 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: '*.jar') 
    compile project(':librarySmartHotel') 
    compile 'com.github.castorflex.smoothprogressbar:library:1.1.0' 
    compile 'com.google.android.gms:play-services:6.5.87' 
} 

android { 
    compileSdkVersion 19 
    buildToolsVersion "22.0.1" 

    defaultConfig { 
     multiDexEnabled true 
    } 

    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src'] 
      resources.srcDirs = ['src'] 
      aidl.srcDirs = ['src'] 
      renderscript.srcDirs = ['src'] 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['assets'] 
     } 

     // Move the tests to tests/java, tests/res, etc... 
     instrumentTest.setRoot('tests') 

     // Move the build types to build-types/<type> 
     // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 
     // This moves them out of them default location under src/<type>/... which would 
     // conflict with src/ being used by the main source set. 
     // Adding new build types or product flavors should be accompanied 
     // by a similar customization. 
     debug.setRoot('build-types/debug') 
     release.setRoot('build-types/release') 
    } 
}