Flutter导入安卓第三方库报错:Flutter Could not find method implementation() 的可能原因及解决办法

编程入门 行业动态 更新时间:2024-10-17 07:27:41

Flutter导入安卓第三方库<a href=https://www.elefans.com/category/jswz/34/1771188.html style=报错:Flutter Could not find method implementation() 的可能原因及解决办法"/>

Flutter导入安卓第三方库报错:Flutter Could not find method implementation() 的可能原因及解决办法

build.gradle里面试图添加引用一个库:

buildscript {ext.kotlin_version = '1.7.10'repositories {google()mavenCentral()}dependencies {classpath 'com.android.tools.build:gradle:7.2.0'classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"implementation 'com.abc.def:ghi:114.514.1919810'}
}

然后运行的时候报错:

A problem occurred evaluating root project 'android'.
> Could not find method implementation() for arguments [com.abc.def:ghi:114.514.1919810] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

可能原因:Flutter项目的android目录下有两个build.gradle文件,一个是android/build.gradle,另一个是android/app/build.gradle,在前者文件里面添加引用就会出这个错,解决办法是改在后者文件中另起一行添加:

dependencies {implementation 'com.abc.def:ghi:114.514.1919810'
}

参考来源:

更多推荐

Flutter导入安卓第三方库报错:Flutter Could not find method implementation() 的可能原因及解决办法

本文发布于:2023-11-15 19:38:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1605166.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:报错   第三方   解决办法   原因   Flutter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!