在编译

时间:2017-05-10 12:40:41

标签: java android-studio gradle dependencies

HY, 我正在尝试使用我最近收到的源代码,但遗憾的是由于标记的依赖项无效,我无法编译它。

这是显示问题的分水岭:

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.1'
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

project(':calendar') {
    apply plugin: 'android-library'

    android {
        compileSdkVersion 25
        buildToolsVersion '25.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']
            }

        }

        lintOptions {
            abortOnError false
        }
    }
}

project(':colorpicker') {
    apply plugin: 'android-library'

    android {
        compileSdkVersion 25
        buildToolsVersion '25.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']
            }
        }
    }
}

project(':datetimepicker') {
    apply plugin: 'android-library'

    dependencies {
        compile 'com.android.support:support-v4:25.1.0'
    }

    android {
        compileSdkVersion 25
        buildToolsVersion '25.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']
            }
        }

        lintOptions {
            abortOnError false
        }
    }
}

project(':timezonepicker') {
    apply plugin: 'android-library'

    dependencies {
        compile 'com.android.support:support-v4:25.1.0'
    }

    android {
        compileSdkVersion 25
        buildToolsVersion '25.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']
            }
        }

        lintOptions {
            abortOnError false
        }
    }
}

project(':ex:chips') {
    apply plugin: 'android-library'

    android {
        compileSdkVersion 25
        buildToolsVersion '25.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']
            }
        }


        lintOptions {
            abortOnError false
        }
    }
}

apply plugin: 'com.android.library'

dependencies {
    compile 'com.android.support:support-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
    compile project(':calendar')
    compile project(':colorpicker')
    compile project(':datetimepicker')
    compile project(':timezonepicker')
    compile project(':ex:chips')
}

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.1'

    defaultConfig {
        minSdkVersion 18
        targetSdkVersion 25
    }

    useLibrary 'org.apache.http.legacy'

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src', 'external/ex/common/java'] // NOTE: this includes external/ex/common/java!
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }


    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
}

我目前收到附图中显示的错误:

enter image description here enter image description here

知道我已将其他帖子中建议的 Android平台SDK更新为25 Android支持存储库 Google存储库

enter image description here

如果我错过了任何所需信息,请告诉我。

我们非常感谢您的帮助和建议。

1 个答案:

答案 0 :(得分:1)

您应该将Gradle依赖项升级到

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

并在android部分中添加

pod lib create CommonCode