Подтвердить что ты не робот

Ошибка: выполнение выполнено для задачи ': app: transformClassesWithFirebasePerformancePluginForRelease'

Я не могу найти происхождение этой ошибки при компиляции в режиме деблокирования. У меня создалось впечатление, что эта ошибка появилась без изменения моего кода (я пытаюсь вернуться с github, но у меня все еще есть эта ошибка).

Ошибка: выполнение выполнено для задачи ': Приложение: transformClassesWithFirebasePerformancePluginForRelease'.

java.io.IOException: указанный путь не найден

Gradle с флагом отладки

22: 36: 11.767 [ERROR] [FirebasePerformancePlugin] Невозможно выполнить команду org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.class

My build.gradle

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

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
        maven {
            url 'https://maven.google.com'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.0'
        classpath 'com.google.firebase:firebase-plugins:1.1.0'
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'http://www.idescout.com/maven/repo/'
        }
        maven {
            url 'https://maven.google.com'
        }
    }
}

Мое приложение /build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'

android {

    compileSdkVersion 26
    buildToolsVersion '26.0.0'
    defaultConfig {
        applicationId ""
        minSdkVersion 16
        targetSdkVersion 26
        multiDexEnabled true

        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
            signingConfig signingConfigs.Keys
        }
        debug {
            signingConfig signingConfigs.Keys
        }
    }
    dexOptions {
        jumboMode = true
    }

    packagingOptions {
        pickFirst 'META-INF/*'
    }
}

repositories {
    jcenter()
}
repositories {
    maven { url "http://repo1.maven.org/maven2" }
    maven { url 'https://jitpack.io' }
    maven { url 'https://maven.fabric.io/public' }
}

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')

    compile 'com.android.support:appcompat-v7:26.0.0-beta2'
    compile 'com.android.support:support-v13:26.0.0-beta2'
    compile 'com.android.support:support-v4:26.0.0-beta2'
    compile 'com.android.support:design:26.0.0-beta2'
    compile 'com.android.support:recyclerview-v7:26.0.0-beta2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:cardview-v7:26.0.0-beta2'
    compile 'com.android.support:customtabs:26.0.0-beta2'

    //firebase
    compile 'com.google.firebase:firebase-ads:11.0.2'
    compile 'com.google.firebase:firebase-core:11.0.2'
    compile 'com.google.firebase:firebase-messaging:11.0.2'
    compile 'com.google.firebase:firebase-auth:11.0.2'
    compile 'com.google.firebase:firebase-database:11.0.2'
    compile 'com.google.firebase:firebase-config:11.0.2'
    compile 'com.google.firebase:firebase-storage:11.0.2'
    compile 'com.google.firebase:firebase-perf:11.0.2'
    compile 'com.firebaseui:firebase-ui-auth:1.2.0'

    //Fabric
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') {
        transitive = true;
    }


    compile 'com.android.support:support-vector-drawable:26.0.0-beta2'
    compile 'commons-io:commons-io:2.5'

    compile 'com.android.support:multidex:1.0.1'
    compile files('libs/aa-poi-ooxml-schemas-3.10-reduced-more-0.1.5.jar')
    compile files('libs/aa-poi-3.10-min-0.1.5.jar')
}

apply plugin: 'com.google.gms.google-services'
4b9b3361

Ответ 1

После переноса моего проекта Android в Gradle Kotlin DSL я также неожиданно получаю ошибку Can't instrument с помощью плагина производительности Firebase для любого класса проекта, включая сторонние зависимости. Сборка в конечном итоге прерывается с OutOfMemoryError. Ошибка

Can't instrument: ...
java.lang.IllegalArgumentException
        at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:79)
        at com.google.firebase.perf.plugin.instrumentation.InstrumentationVisitor.<init>(InstrumentationVisitor.java:55)
        ...

Глядя на исходный код ASM ClassVisitor, я вижу, что IllegalArgumentException добавляется в конструктор, когда передается необработанная версия API. perf-plugin требует версии 7.0 ASM. Однако, проверяя зависимости проекта с помощью ./gradlew :app:dependencies, я обнаружил, что используется версия 6.0 ASM. Очевидно, что для некоторых других зависимостей требуется 6.0.

Я попытался явно перезаписать зависимость ASM с помощью

configurations.all {
    resolutionStrategy.eachDependency {
        if (requested.group == "org.ow2.asm") {
            useVersion("7.0")
            because("Version required by Firebase Performance Plugin")
        }
    }
}

и в выводе ./gradlew :app:dependencies я теперь вижу, что используется 7.0, но я все еще получаю эту ошибку: (

Обновление: Понижение com.google.firebase:firebase-plugins с 1.2.0 до 1.1.5 решает проблему для меня.

Обновление 2: Начиная с версии 2.0.0 firebase-plugins его использование устарело. Рекомендуемое решение - использовать плагин Performance Monitoring явно. После перехода на новый плагин проблема теперь для меня решена.

Обновление 3: Я должен отозвать свое предыдущее выражение. Использование плагина Performance Monitor исправило сборку на моем локальном компьютере, но не на моем сервере сборки Jenkins. Также перемещение блока configurations.all, упомянутого выше, в блок buildscript, как прокомментировал Антимонит, не исправило сборку, хотя я могу видеть в выходных данных ./gradlew buildEnvironment, что ASM 7.0 используется для сборки.

Ответ 2

Причина: когда зависимость classpath от perf-plugin определена в файле build.gradle уровня build.gradle вместо файла build.gradle уровня build.gradle, perf-plugin (во время выполнения) получает ASM v6 dep, даже если в нем POM файл ASM V7 Деп объявлен. Это вызывает исключение IllegalArgumentException в perf-plugin v1.2.0 и v1.2.1 потому что они зависят от ASM v7, однако это прекрасно работает для v1.1.5 потому что это зависит от ASM v6.

Есть множество сообщений здесь, объясняющие, почему путь к классам верхнего уровня buildscript предназначен, чтобы отличаться от остальной части проекта:


Решение: это поведение gradle. Быстрое решение этой проблемы состоит в том, чтобы определить зависимость perf-plugin только в корневом проекте build.gradle (который уже упоминался в открытых документах).


Детальное объяснение:

Нет ошибок

root-проект build.gradle

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

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.google.firebase:perf-plugin:1.2.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

уровень приложения build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'


. . .

dependencies {
    implementation 'com.google.firebase:firebase-perf:17.0.2'
}

BUG

root-проект build.gradle

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

buildscript {
    repositories {
        google()
        jcenter()
    }

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

уровень приложения build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.google.firebase:perf-plugin:1.2.1'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'


. . .

dependencies {
    implementation 'com.google.firebase:firebase-perf:17.0.2'
}

Сравнение команды $./gradlew clean :buildEnvironment в обоих случаях показывает, что все ссылки на org.ow2.asm:asm:6.0 преобразуются в org.ow2.asm:asm:7.0 в случае отсутствия org.ow2.asm:asm:7.0 но это не так произошло в случае ошибки:

Нет ошибок

> Task :buildEnvironment

------------------------------------------------------------
Root project
------------------------------------------------------------

.  .  .

    +--- com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta04
|    |    +--- org.ow2.asm:asm:6.0 -> 7.0
|    |    +--- org.ow2.asm:asm-util:6.0 (*)
|    |    +--- org.ow2.asm:asm-commons:6.0 (*)
|    |    +--- org.jdom:jdom2:2.0.6
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.0 -> 1.3.31 (*)
|    |    \--- com.android.tools.build.jetifier:jetifier-core:1.0.0-beta04 (*)
|    +--- com.google.protobuf:protobuf-java:3.4.0
|    \--- com.google.protobuf:protobuf-java-util:3.4.0 (*)
\--- com.google.firebase:perf-plugin:1.2.1
     \--- org.ow2.asm:asm:7.0

BUG

> Task :buildEnvironment

------------------------------------------------------------
Root project
------------------------------------------------------------

.  .  .

     +--- com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta04
     |    +--- org.ow2.asm:asm:6.0
     |    +--- org.ow2.asm:asm-util:6.0 (*)
     |    +--- org.ow2.asm:asm-commons:6.0 (*)
     |    +--- org.jdom:jdom2:2.0.6
     |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.0 -> 1.3.31 (*)
     |    \--- com.android.tools.build.jetifier:jetifier-core:1.0.0-beta04 (*)
     +--- com.google.protobuf:protobuf-java:3.4.0
     \--- com.google.protobuf:protobuf-java-util:3.4.0 (*)