liyufengrex / flutter_subscreen_plugin

flutter插件:支持 Android 设备双屏显示,主副屏皆使用 flutter 绘制,通过 channel 双引擎实现主副屏通信交互。
BSD 3-Clause "New" or "Revised" License
123 stars 24 forks source link

Flutter Execution failed for task flutter_subscreen_plugin:compileDebugKotlin. Failed to transform flutter.jar to match attributes #4

Closed anandsubbu007 closed 12 months ago

anandsubbu007 commented 2 years ago

https://stackoverflow.com/questions/73079150/flutter-execution-failed-for-task-compiledebugkotlin-failed-to-transform-flutt

Can't able to debug this flutter project.

This error occurs only on one of my devices. but on my other device, it is working fine.

I checked for all configurations between devices all were same.

if I removed this package "flutter_subscreen_plugin" I can able to debug.

[+14758 ms] FAILURE: Build failed with an exception.
[  +15 ms] * What went wrong:
[   +8 ms] Execution failed for task ':flutter_subscreen_plugin:compileDebugKotlin'.
[   +4 ms] > Could not resolve all files for configuration ':flutter_subscreen_plugin:debugCompileClasspath'.
[   +1 ms]    > Failed to transform flutter.jar to match attributes {artifactType=android-classes-jar,
org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
[  +37 ms]       > Execution failed for JetifyTransform:
C:\Users\anand_epaisa\fvm\default\bin\cache\artifacts\engine\android-arm\flutter.jar.
[  +16 ms]          > Transform's input file does not exist:
C:\Users\anand_epaisa\fvm\default\bin\cache\artifacts\engine\android-arm\flutter.jar. (See
https://issuetracker.google.com/issues/158753935)
[   +4 ms] * Try:
[   +1 ms] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
[   +2 ms] * Get more help at https://help.gradle.org
[   +4 ms] BUILD FAILED in 55s
[   +7 ms] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[  +13 ms] Use '--warning-mode all' to show the individual deprecation warnings.
[   +4 ms] See https://docs.gradle.org/7.0-rc-1/userguide/command_line_interface.html#sec:command_line_warnings
[   +2 ms] 430 actionable tasks: 2 executed, 428 up-to-date
[ +766 ms] Running Gradle task 'assembleDebug'... (completed in 59.2s)
[   +9 ms] 
           This issue appears to be https://github.com/flutter/flutter/issues/58247.
           Fix this issue by adding the following to the file
           C:\Users\anand_epaisa\Desktop\EatOs\eo-pos-app-flutter\eatOS\android\app\build.gradle:
           android {
             lintOptions {
               checkReleaseBuilds false
             }
           }
[  +12 ms] Exception: Gradle task assembleDebug failed with exit code 1
[   +3 ms] "flutter run" took 70,201ms.
[   +5 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:674:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1140:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:94:3)
           <asynchronous suspension>

[ +306 ms] ensureAnalyticsSent: 303ms
[ +165 ms] Running shutdown hooks
[  +39 ms] Shutdown hooks complete
[  +40 ms] exiting with code 1

android/build.gradle

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        jcenter()

    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.0'
        classpath 'com.google.gms:google-services:4.3.5'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

Gradle property

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

android/app/build.gradle

android {
    compileSdkVersion 31

    lintOptions {
        disable 'InvalidPackage'
        checkReleaseBuilds false
    }

    defaultConfig {
        applicationId "com.android.subbu"
        minSdkVersion 21
        targetSdkVersion 31
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            // signing
            signingConfig signingConfigs.release
            minifyEnabled true
            shrinkResources true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    splits {
        abi {
            enable true
            reset()
            // Specifies a list of ABIs that Gradle should create APKs for.
            include "x86", "x86_64", "armeabi", "armeabi-v7a", "arm64-v8a"
            universalApk true
        }
    }
}

dependencies {
    implementation 'com.android.support:multidex:1.0.3'
    implementation "com.google.android.gms:play-services-maps:10.0.1"
}

Flutter doctor -v

flutter doctor -v
[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.14393], locale en-US)
    • Flutter version 2.8.1 at C:\Users\anand\fvm\default
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (7 months ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at C:\Program_Setups\android_sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: C:\Program_Setups\Android_studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[√] Android Studio (version 2021.2)
    • Android Studio at C:\Program_Setups\Android_studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] VS Code (version 1.69.2)
    • VS Code at C:\Users\anand\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.44.0

[√] Connected device (2 available)
    • Android SDK built for x86 (mobile) • localhost:15555 • android-x86    • Android 11 (API 30) (emulator)
    • Edge (web)                         • edge            • web-javascript • Microsoft Edge 103.0.1264.62

! Doctor found issues in 1 category.