2015-05-04 71 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') 
    } 
}