android - 项目刷新失败 - 错误 :Cause: org/gradle/internal/TrueTimeProvider

标签 android android-studio gradle

从 github 导入这个项目,我遇到了这个消息:

Gradle 'GameOfLife-master' project refresh failed
Error:Cause: org/gradle/internal/TrueTimeProvider

我已经尝试过发布 here 的解决方案,清理/重建(至少尝试)项目,使缓存无效并尝试不同版本的 Gradle。这些都没有奏效。其他人有任何想法吗?

模块:app - build.gradle
buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'
        classpath "com.neenbedankt.gradle.plugins:android-apt:1.8"
        classpath 'com.jakewharton.hugo:hugo-plugin:1.1.0'
        classpath "net.rdrei.android.buildtimetracker:gradle-plugin:0.5.+"
        classpath 'io.fabric.tools:gradle:1.+'
        classpath 'hu.supercluster:paperwork-plugin:1.2.7'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'io.fabric'
apply plugin: 'hugo'
apply plugin: "build-time-tracker"
apply plugin: 'hu.supercluster.paperwork'

paperwork {
    set = [
            gitInfo:   gitInfo(),
            gitSha:    gitSha(),
            buildTime: buildTime("yyyy-MM-dd HH:mm:ss", "GMT+01:00")
    ]
}

def versionMajor = 1
def versionMinor = 2
def versionPatch = 0

android {
    compileSdkVersion androidCompileSdkVersion
    buildToolsVersion androidBuildToolsVersion

    defaultConfig {
        applicationId 'hu.supercluster.gameoflife'
        minSdkVersion androidMinSdkVersion
        targetSdkVersion androidTargetSdkVersion

        versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
        versionName "${versionMajor}.${versionMinor}.${versionPatch}"

        testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
    }

    signingConfigs {
        alpha {}
        beta {}
        release {}
    }

    buildTypes {
        debug {
            applicationIdSuffix ".debug"
            versionNameSuffix "-debug"
            resValue "string", "app_name_for_buildtype", "Game of Life (debug)"
            minifyEnabled false
            testCoverageEnabled = false
        }

        alpha {
            applicationIdSuffix ".alpha"
            versionNameSuffix "-alpha"
            resValue "string", "app_name_for_buildtype", "Game of Life (alpha)"
            minifyEnabled false
            testCoverageEnabled = false
            lintOptions {
                disable 'MissingTranslation'
            }
        }

        beta {
            applicationIdSuffix ".beta"
            versionNameSuffix "-beta"
            resValue "string", "app_name_for_buildtype", "Game of Life (beta)"
            minifyEnabled false
            testCoverageEnabled = false
        }

        release {
            resValue "string", "app_name_for_buildtype", "Game of Life"
            minifyEnabled false
            proguardFile 'proguard-project.txt'
        }
    }

    sourceSets.main {
        // src/gen is the target for generated content like json model
        java.srcDirs += 'build/generated/source/db'
    }

    // avoid errors with message 'Duplicate files copied in APK ...'
    packagingOptions {
        exclude 'LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }
}

afterEvaluate {
    def propsFile = rootProject.file('keystore.properties')
    def configName = 'release'

    if (propsFile.exists() && android.signingConfigs.hasProperty(configName)) {
        def props = new Properties()
        props.load(new FileInputStream(propsFile))
        android.signingConfigs[configName].storeFile = rootProject.file(props['storeFile'])
        android.signingConfigs[configName].storePassword = props['storePassword']
        android.signingConfigs[configName].keyAlias = props['keyAlias']
        android.signingConfigs[configName].keyPassword = props['keyPassword']
    }
}

repositories {
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
}


dependencies {
    compile 'com.android.support:appcompat-v7:24.2.0'
    compile 'com.android.support:support-annotations:24.2.0'
    compile 'com.android.support:support-v13:24.2.0'
    compile 'com.android.support:support-v4:24.2.0'

    // ---------

    compile 'com.github.tslamic.adn:library:1.0'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true }
    compile 'com.jakewharton.timber:timber:2.5.1'
    compile 'com.squareup:otto:1.3.6'
    compile 'hu.supercluster:paperwork:1.2.7'

    // ---------

    apt "org.androidannotations:androidannotations:" + androidAnnotationsVersion
    compile("org.androidannotations:androidannotations-api:" + androidAnnotationsAPIVersion )

    testCompile 'junit:junit:4.11'
    testCompile 'org.mockito:mockito-core:1.9.5'
    testCompile('com.squareup:fest-android:1.0.+') { exclude module: 'support-v4' }
    testCompile "org.robolectric:robolectric:3.0"

    androidTestCompile 'com.google.guava:guava:14.0.1',
            'com.squareup.dagger:dagger:1.1.0',
            'org.hamcrest:hamcrest-integration:1.1',
            'org.hamcrest:hamcrest-core:1.1',
            'org.hamcrest:hamcrest-library:1.1',
            'com.jakewharton.espresso:espresso:1.1-r3'
}

apt {
    arguments {
        resourcePackageName android.defaultConfig.applicationId
        androidManifestFile variant.outputs[0]?.processResources?.manifestFile
    }
}

apply plugin: 'idea'

idea {
    module {
        //and some extra test source dirs
        testSourceDirs += file('src/test')
    }
}

apply from: 'build-time-tracker.gradle'

最佳答案

您可以使用 --stacktrace 运行获取完整的异常堆栈跟踪

Gradle 有 public 的概念API 和 private API。基本上是 org.gradle.internal 中的任何内容是私有(private) API 的一部分,gradle 团队可以在 gradle 版本之间更改/删除这些类。理想情况下,插件不应该引用 internal类。任何引用 internal 的插件作者API 必须了解,此代码可能会随着 Gradle 的新版本而中断。

看起来您的插件之一正在引用 internal API ( org.gradle.internal.TrueTimeProvider ) 并且该插件是针对一个版本的 Gradle 构建的,而您正在使用不同版本的 gradle 运行。

要解决此问题,您需要确定哪个插件引发了异常(--stacktrace 将在此处提供帮助)。然后,您需要将插件版本更改为与您的 gradle 版本兼容的版本,或者更改您正在运行的 gradle 版本。

关于android - 项目刷新失败 - 错误 :Cause: org/gradle/internal/TrueTimeProvider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44391665/

相关文章:

Android studio 省略断点

android - 是否必须使用api 22 Lollipop 编译我的应用程序?

android - android studio中png图像的白色背景

Android Firebase 电话身份验证 INVALID_APP_CREDENTIAL :App validation failed

java - Android Studio 错误 OnCreate

android-studio - 找不到参数的方法 implementation() [DefaultProjectDependency {dependencyProject ='project ' :app '', configuration=' default'}]

java - 我无法从 Activity 调用 Fragment 方法

java - 使用 gradle 与 spring mvc 进行 Bootstrap

java - 如何使用 gradle + spring boot 1.5 构建子模块的可执行 jar

android - 使用 AsyncTask 的图像是并行下载还是顺序下载?