GradleSample icon indicating copy to clipboard operation
GradleSample copied to clipboard

编译OK,但是跑起来的时候,会报错,提示 > Could not resolve com.google.code.gson:gson:2.10.

Open aheadlcx opened this issue 2 years ago • 3 comments

测试中,用了这个库 com.google.code.gson:gson:2.10

  1. 本地提前include 一个 group = com.google.code.gson, moduleName = gson 的模块,
  2. 不过这个库仅仅有一个 Gson 类,而且也只有一个函数, toJson()
  3. 使用的地方,也仅仅使用了 Gson.toJson() 函数。
  4. 看了下插件,是调用了 depend.useTarget 的了。

error msg:

Could not resolve com.google.code.gson:gson:2.10. Required by: project :app > No matching configuration of project :gson was found. The consumer was configured to find a runtime of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.2.2', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but: - None of the consumable configurations have attributes.

aheadlcx avatar Dec 07 '22 13:12 aheadlcx