我继承了一个使用cordova -的cordova项目,它似乎是访问扩展文件(也称为OBB)的标准插件。我遇到了一个问题,我希望会影响其他科多瓦插件。运行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.这已经被其他人报告为插件论坛上的一个bug,但是解决方法不可靠:
https://github.com/agamemnus/cordova-plugin-xapkreader/issues/116
问题似乎在于,gradle希望您现在使用的是implementation,而不是compile、debugCompile等。该插件的gradle文件是由cordova生成的,基于cordova-android内部的一个模板。建议的解决方法是修改从cordova钩子运行的脚本中的模板(或生成的gradle文件)。不幸的是,由于某些原因,钩子似乎无法可靠地工作--有时是这样,有时不是。这可能是因为钩子与构建过程的其余部分异步运行所造成的竞争状况--所以有时gradle构建在修改gradle文件之前就已经启动了。
有没有人想过如何正确地解决这个问题?有人知道为什么这不是科多瓦-安卓项目没有通过修改模板来解决的一个更广泛的问题吗?我可以通过降低构建过程的某些部分来修复这个问题吗?
我对科多瓦非常陌生,所以这一切都很令人困惑,任何帮助都是非常感谢的!
发布于 2019-05-15 10:36:23
不幸的是,由于某种原因,钩子似乎无法可靠地工作--有时是这样,有时不是。这可能是因为钩子与构建过程的其余部分异步运行所造成的竞争状况--因此有时gradle构建在可以修改gradle文件之前就已经启动了。
我认为可以通过让钩子返回一个承诺来解决这个问题,这样您就可以确保构建的其余部分不会并行运行。我发布了我在github问题上使用的代码。
狂欢守则如下:
const deferral = context.requireCordovaModule('q').defer();return deferral.promise;deferral.resolve();https://stackoverflow.com/questions/50157599
复制相似问题