【发布时间】:2018-05-03 14:32:59
【问题描述】:
我继承了一个使用cordova-plugin-xapkreader 的cordova 项目,它似乎是用于访问扩展(又名OBB)文件的标准插件。我遇到了一个问题,我希望它会影响其他cordova插件。运行cordova build android时出现以下错误:
Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead.
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'compile' in project ':com.flyingsoftgames.xapkreader:downloader_library' is deprecated. Use 'implementation' instead.
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'debugCompile' in project ':com.flyingsoftgames.xapkreader:downloader_library' is deprecated. Use 'debugImplementation' instead.
Configuration 'releaseCompile' in project ':com.flyingsoftgames.xapkreader:downloader_library' is deprecated. Use 'releaseImplementation' instead.
Configuration 'compile' in project ':com.flyingsoftgames.xapkreader:library' is deprecated. Use 'implementation' instead.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':debugCompileClasspath'.
> Could not resolve project :com.flyingsoftgames.xapkreader:library.
Required by:
project : > project :com.flyingsoftgames.xapkreader:downloader_library
> Project :com.flyingsoftgames.xapkreader:downloader_library declares a dependency from configuration 'debugCompile' to configuration 'debug' which is not declared in the descriptor for project :com.flyingsoftgames.xapkreader:library.
这已被其他人报告为插件论坛上的错误,但解决方法并不可靠:
https://github.com/agamemnus/cordova-plugin-xapkreader/issues/116
问题似乎是 gradle 希望您现在使用 implementation 而不是 compile、debugCompile 等。插件的 gradle 文件由 cordova 基于 cordova-android 中的模板生成。建议的解决方法是在从 cordova 挂钩运行的脚本中修改模板(或生成的 gradle 文件)。不幸的是,由于某种原因,这些钩子似乎不能可靠地工作 - 有时它们会,有时它们不会。这感觉可能是由于钩子与构建过程的其余部分异步运行导致的竞争条件 - 所以有时 gradle 构建在修改 gradle 文件之前就已经开始了。
有没有人知道如何正确解决这个问题?有谁知道为什么这不是 cordova-android 项目没有通过修改他们的模板来解决的更广泛的问题?我可以通过降级构建过程的某些部分来解决这个问题吗?
我对 Cordova 还是很陌生,所以这一切都很令人费解,非常感谢任何帮助!
【问题讨论】: