2017-07-19 41 views
4

我嘗試從我的終端執行命令:./gradlew testfairyDebug。 這返回一個錯誤:無法獲取任務的未知屬性'outputFile':app:packageDebug'

FAILURE: Build failed with an exception.

What went wrong: Execution failed for task ':app:testfairyDebug'. Could not get unknown property 'outputFile' for task ':app:packageDebug' of type com.android.build.gradle.tasks.PackageApplication.

你有什麼想法來解決這個問題。 有關信息,我在Android工作室3的工作和我gradle這個版本是'com.android.tools.build:gradle:3.0.0-alpha6'

我的build.gradle:


    // Top-level build file where you can add configuration options common to all sub-projects/modules. 

    buildscript { 
     ext.kotlin_version = '1.1.2-4' 
     repositories { 
      maven { url 'https://maven.google.com' } 
      maven { url 'https://www.testfairy.com/maven' } 
      jcenter() 
     } 
     dependencies { 
      classpath 'com.android.tools.build:gradle:3.0.0-alpha6' 
      classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 
      classpath 'com.testfairy.plugins.gradle:testfairy:1.+' 

      // NOTE: Do not place your application dependencies here; they belong 
      // in the individual module build.gradle files 
     } 
    } 


    allprojects { 
     repositories { 
      jcenter() 
      maven { url 'https://maven.google.com' } 
      mavenCentral() 
     } 
    } 

    task clean(type: Delete) { 
     delete rootProject.buildDir 
    } 

和我的app.build.gradle:


    apply plugin: 'com.android.application' 

    apply plugin: 'kotlin-android' 
    apply plugin: 'kotlin-android-extensions' 

    apply plugin: 'testfairy' 

    android { 
     compileSdkVersion 25 
     buildToolsVersion "25.0.2" 
     defaultConfig { 
      applicationId "com.name.application" 
      minSdkVersion 15 
      targetSdkVersion 25 
      versionCode 1 
      versionName "1.0" 
      testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 

     } 
     buildTypes { 
      release { 
       minifyEnabled false 
       proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
      } 
     } 

     testfairyConfig { 
      apiKey "xxxxxxxxxxxxxxxxxxxxxxxx" 
     } 
    } 

    dependencies { 
     compile fileTree(include: ['*.jar'], dir: 'libs') 
     androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
      exclude group: 'com.android.support', module: 'support-annotations' 
     }) 
     compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" 
     //noinspection GradleCompatible 
     compile 'com.android.support:appcompat-v7:25.3.1' 
     testCompile 'junit:junit:4.12' 
     compile 'com.android.support.constraint:constraint-layout:1.0.2' 
     compile 'com.android.support:design:25.3.1' 
     compile 'org.greenrobot:eventbus:3.0.0' 
     compile 'com.squareup.retrofit2:retrofit:2.1.0' 
     compile 'com.squareup.retrofit2:converter-gson:2.1.0' 
     compile 'com.lorentzos.swipecards:library:1.0.9' 
     compile 'com.github.rey5137:material:1.2.2' 
     compile 'com.squareup.picasso:picasso:2.5.2' 
     // Android SDK 
     compile 'com.facebook.android:facebook-android-sdk`enter code here`:4.+' 
     compile 'org.greenrobot:eventbus:3.0.0' 
     compile 'com.android.support:recyclerview-v7:25.1.1' 
     compile 'testfairy:testfairy-android-sdk:[email protected]' 

    } 

非常感謝。

回答

3

錯誤表明您正試圖從PackageApplication訪問'outputFile'。但我沒有在你的gradle文件中看到它。也許它是由你的一個模塊引起的?如果是這種情況,使用Gradle插件3.0破壞Variant API來處理變體輸出。只有簡單的任務工作。看看這個網頁:https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#variant_api

+0

無賴!有用的功能犧牲了「更快的配置時間」。看起來像是一個明顯的過度優化案例。回滾到2.3.3 ... – donfuxx

1

請問您可以更新TestFairy gradle插件到2.+版本。

將您的build.gradle文件的依賴項部分中的類路徑com.testfairy.plugins.gradle:testfairy:1.+更改爲com.testfairy.plugins.gradle:testfairy:2.+

相關問題