最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

runtime error - When I am adding a dependency in flutter pupspec.yaml and run application showing this issue - Stack Overflow

programmeradmin8浏览0评论

Execution failed for task ':flutter_plugin_android_lifecycle:compileDebugJavaWithJavac'.

Could not resolve all files for configuration ':flutter_plugin_android_lifecycle:androidJdkImage'. Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, .gradle.libraryelements=jar, .gradle.usage=java-runtime}. after adding dependency

Execution failed for task ':flutter_plugin_android_lifecycle:compileDebugJavaWithJavac'.

Could not resolve all files for configuration ':flutter_plugin_android_lifecycle:androidJdkImage'. Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, .gradle.libraryelements=jar, .gradle.usage=java-runtime}. after adding dependency

Share Improve this question edited Mar 20 at 13:57 marc_s 756k184 gold badges1.4k silver badges1.5k bronze badges asked Mar 20 at 12:04 Vivek Vivek 11 bronze badge 1
  • Please provide enough code so others can better understand or reproduce the problem. – Community Bot Commented Mar 24 at 1:10
Add a comment  | 

1 Answer 1

Reset to default 1

Need to do the below steps

  1. Change in your app level build.gradle

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    
    kotlinOptions {
        jvmTarget = "17"
    }
    
  2. Change in gradle properties

    .gradle.java=C:\Program Files\Java\jdk-17
    
  3. Set the JDK path by using the Android Studio Terminal

    flutter config --jdk-dir="C:\\Program Files\\Java\\jdk-17"  
    

    NOTE - SET YOUR SYSTEM JDK PATH.

then run these commands-

  1. flutter clean

  2. flutter pub get

  3. flutter run

If issue still exists, then restart your Android Studio (IDE) and run the above commands again. Hopefully the issue would be resolved.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论