【问题标题】:Android Gradle sync exception with the Smooth Progress Bar project平滑进度条项目的 Android Gradle 同步异常
【发布时间】:2015-07-13 13:33:32
【问题描述】:

我正在尝试添加这个library,但是当我尝试同步 Gradle 时,编译器给了我这个错误:

错误:(6, 13) 无法解决: com.github.castorflex.smoothprogressbar:library:1.1.0

如果解决这个问题很重要,我的项目中有this 其他问题发布在堆栈溢出中。

这是我的项目结构:

这是所有项目的 build.grade 文件

主要的warper项目(guestperience 1.0.1 Moncloa De San Lazaro):

// 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')
    }
}

图书馆智能酒店:

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')
    }
}

我在想一些配置丢失(也许),事实是我超级迷路。

我能看到的唯一想法是库甚至没有在外部库部分下载。

更新:

我可以看到它在我的 Android Studio 中是全局的,我无法从另一个数据存储库中添加任何东西。

【问题讨论】:

    标签: java android android-studio gradle


    【解决方案1】:

    您只需在文件开头添加以下内容:

    repositories {
        mavenCentral()
    }
    

    您也可以启用“离线模式”。

    检查文件 -> 构建、执行、部署 -> Maven/Gradle“离线工作”是否已启用,如果是,请禁用它并同步 Gradle。

    仅此而已。

    在我的情况下,由于 Play 服务,我还添加了这个:

    defaultConfig {
        multiDexEnabled true
    }
    

    你会以这样的文件结束:

    应用插件:'com.android.application'

    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')
        }
    }
    

    【讨论】:

      【解决方案2】:

      我在将 android studio 更新到最新版本时遇到了同样的问题,然后我只是更新了 Project:Grandle 版本以稳定错误消失了

      【讨论】:

        猜你喜欢
        • 2016-04-22
        • 2014-07-03
        • 2014-04-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多