ไม่สามารถรับคุณสมบัติ 'outputFile' ที่ไม่รู้จักสำหรับงาน ':app:packageDebug'

ฉันพยายามดำเนินการจากเทอร์มินัลของฉันคำสั่ง: ./gradlew testfairyDebug สิ่งนี้ส่งคืนข้อผิดพลาดถัดไป:

ความล้มเหลว: การสร้างล้มเหลวโดยมีข้อยกเว้น

เกิดอะไรขึ้น: การดำเนินการล้มเหลวสำหรับงาน ':app:testfairyDebug' ไม่สามารถรับคุณสมบัติ 'outputFile' ที่ไม่รู้จักสำหรับงาน ':app:packageDebug' ประเภท com.android.build.gradle.tasks.PackageApplication

คุณมีความคิดที่จะแก้ไขปัญหานี้หรือไม่ สำหรับข้อมูล ฉันใช้งาน Android Studio 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:1.+@aar'
    
    }

ขอบคุณมาก.


person PAx    schedule 19.07.2017    source แหล่งที่มา


คำตอบ (2)


ข้อผิดพลาดบ่งชี้ว่าคุณกำลังพยายามเข้าถึง 'outputFile' จาก PackageApplication แต่ฉันไม่เห็นมันในไฟล์ gradle ของคุณ อาจเกิดจากหนึ่งในโมดูลของคุณ? หากเป็นเช่นนั้น Variant API เพื่อจัดการเอาต์พุตของตัวแปรจะใช้งานไม่ได้ด้วยปลั๊กอิน Gradle 3.0 งานง่ายๆเท่านั้นที่ทำงาน ลองดูหน้านี้: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#variant_api

person Vicki Jin    schedule 27.07.2017
comment
คนเกียจคร้าน! ..ฟังก์ชั่นที่มีประโยชน์ต้องเสียสละเพื่อเวลาการกำหนดค่าที่รวดเร็วยิ่งขึ้น ดูเหมือนเป็นกรณีที่ชัดเจนของการเพิ่มประสิทธิภาพมากเกินไปสำหรับฉัน ย้อนกลับไปเป็น 2.3.3... - person donfuxx; 30.10.2017
comment
การเปลี่ยนแปลงที่จำเป็นสำหรับสิ่งเดียวกัน output.packageApplication.outputFile = ไฟล์ใหม่ (apk.parent, apkName + '.apk') - person Hiren Patel; 27.04.2018

คุณช่วยอัปเดตปลั๊กอิน gradle TestFairy เป็นเวอร์ชัน 2.+ ได้ไหม

เปลี่ยน classpath com.testfairy.plugins.gradle:testfairy:1.+ เป็น com.testfairy.plugins.gradle:testfairy:2.+ ในส่วนการขึ้นต่อกันของไฟล์ build.gradle ของคุณ

person giltsl    schedule 21.02.2018