否则将报告上述错误

发布时间:2025-06-24 19:49:31  作者:北方职教升学中心  阅读量:146


...略android { namespace 'xxx.xxx.xxx' // 增加namespace}...略。否则将报告上述错误。vscode提示需要更新gradle版本。

  • android/build.两个变化的gradle。

    项目的一些位置需要改变。 包括所有外部引入的包,

    报错提示: Cannot use @TaskAction annotation on method IncrementalTask.taskAction$gradle_core() because interface。

    gradle-wrapper.properties。

  • java版本更新到21.000.5,打开flutter项目时,

    android/build.两个变化的gradle。  

    android/build.gradle在两个地方变更。

    • 项目的一些位置需要改变。
      • gradle-wrapper.properties。

        android/app/build.gradle。

        gradle与插件版本相对应。

        Script 'D:\Program Files\flutter\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy' line: 1349* Where:Script 'D:\Program Files\flutter\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy' line: 1349* What went wrong:* What went wrong:A problem occurred evaluating root project 'android'.A problem occurred evaluating root project 'android'.> A problem occurred configuring project ':app'.   > Could not create task ':app:copyFlutterAssetsDebug'.> A problem occurred configuring project ':app'.   > Could not create task ':app:copyFlutterAssetsDebug'.      > Could not create task ':app:mergeDebugAssets'.      > Could not create task ':app:mergeDebugAssets'.         > Cannot use @TaskAction annotation on method IncrementalTask.taskAction$gradle_core() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.。

        android/app/build.gradle。
      • gradle与插件版本相对应。

        buildscript { ...略 dependencies { classpath 'com.android.tools.build:gradle:8.7.0' // gradle8.9版对应 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } ...略}。

        FAILURE: Build failed with an exception.* What went wrong:A problem occurred configuring project ':uni_links'.> Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl. > Namespace not specified. Specify a namespace in the module's build file: C:\Users\alex\AppData\Local\Pub\Cache\hosted\pub.flutter-io.cn\uni_links-0.5.1\android\build.gradle. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace. If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.* Try:> 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.> Get more help at https://help.gradle.org.。

        distributionBase=GRADLE_USER_HOMEdistributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zipdistributionPath=wrapper/distszipStorePath=wrapper/distszipStoreBase=GRADLE_USER_HOME。

        报错: Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.。
        添加namespace,

        gradle版本更新到8.9。 待续。

      • android/app/build.gradle。

        https://developer.android.google.cn/build/releases/gradle-plugin?hl=zh-cn。

        文章没有完成,