使用cordova android 6.4.0构建cordova插件xapkreader

使用cordova android 6.4.0构建cordova插件xapkreader,android,cordova,gradle,Android,Cordova,Gradle,我继承了一个使用cordova插件xapkreader的cordova项目,它似乎是访问扩展(又称OBB)文件的标准插件。我遇到了一个问题,我希望它会影响其他cordova插件。我在运行cordova build android时遇到以下错误: Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead. publishNonDefault is deprecated and has no

我继承了一个使用cordova插件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.
其他人在插件的论坛上报告说这是一个bug,但解决方法不可靠:

问题似乎是gradle希望您现在使用
实现
,而不是
编译
调试编译
等。插件的gradle文件由cordova根据cordova android内部的模板生成。建议的解决方法是在从cordova钩子运行的脚本中修改模板(或生成的gradle文件)。不幸的是,由于某些原因,挂钩似乎不能可靠地工作——有时能,有时不能。这感觉可能是由于钩子与构建过程的其余部分异步运行所导致的竞争条件造成的,因此有时候gradle构建在gradle文件可以修改之前就已经启动了

有没有人知道如何正确解决这个问题?有人知道为什么cordova android项目没有通过修改模板来解决这一更广泛的问题吗?我可以通过降低构建过程的某些部分来解决这个问题吗

我是科尔多瓦的新手,所以这一切都让人困惑,非常感谢您的帮助

不幸的是,由于某些原因,挂钩似乎不能可靠地工作 -有时他们会,有时他们不会。这感觉可能是由于异步运行的钩子导致的竞争条件 对于构建过程的其余部分-所以有时候gradle构建 在可以修改渐变文件之前启动

我认为可以通过使钩子返回一个承诺来解决这个问题,这样可以确保构建的其余部分不会并行运行。我发布了我在github问题上使用的代码

相关代码如下:
-在钩子的开头创建承诺:
const deleral=context.requireRecordovaModule('q').defer()
-在钩子的末尾返回承诺:
返回延迟.promise
-一旦工作完成(文件已写入),解决承诺:
delay.resolve()