android - Cordova Android 插件失败
问题描述
我有一个我正在尝试创建的 Cordova 插件
我有一个看起来像这样的文件夹结构
- src/
- android/
- *.java
- infinitumscanner.aar
- infinitumscanner.gradle
- www/
- *.js
- plugin.xml
我的 plugin.xml 看起来像这样
在 gradle 我有以下代码,依赖项是 .aar 文件使用的
repositories{
jcenter()
flatDir{
dirs 'libs'
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.gms:play-services-vision:20.1.3'
implementation 'com.google.code.gson:gson:2.8.6'
implementation files('libs/infinitumscanner.aar')
}
android {
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
在我的 Cordova 应用程序中,当我使用时cordova build
出现以下错误,我通过使用安装了插件cordova plugin add ../ScannerPlugin
D:\Cordova\TestApp>cordova build
cordova-plugin-androidx: Updated gradle.properties to enable AndroidX
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\AndroidSdk (recommended setting)
ANDROID_HOME=C:\AndroidSdk (DEPRECATED)
Using Android SDK: C:\AndroidSdk
> Task :app:processDebugManifest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform infinitumscanner.aar to match attributes {artifactType=android-manifest}.
> Execution failed for JetifyTransform: D:\Cordova\TestApp\platforms\android\app\libs\infinitumscanner.aar.
> Failed to transform 'D:\Cordova\TestApp\platforms\android\app\libs\infinitumscanner.aar' using Jetifier. Reason: FileNotFoundException, message: D:\Cordova\TestApp\platforms\android\app\libs\infinitumscanner.aar (The system cannot find the path specified). (Run with --stacktrace for more details.)
Please file a bug at http://issuetracker.google.com/issues/new?component=460323.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 14s
21 actionable tasks: 2 executed, 19 up-to-date
Command failed with exit code 1: D:\Cordova\TestApp\platforms\android\gradlew cdvBuildDebug -b D:\Cordova\TestApp\platforms\android\build.gradle
解决方案
推荐阅读
- java - 如何使用动态字段围绕枚举创建包装类
- c# - 从 PictureBox 保存图像
- database - 根据两行之间的差异选择列
- java - 在 Spring Boot 中使用 JPA 和实体管理器中的两个 JNDI
- visual-studio - 无论版本如何,都无法让 NUnit 工作
- c# - 为什么PHPMailer可以覆盖“setFrom”而不是.Net的System.Net.Mail?
- amazon-web-services - 如何在资源中使用通配符 aws lambda 函数权限
- scala - 如何使用 Spark Cassandra 连接器创建表?
- sql - 如果有多个值,则选择一列不为空的行,如果有 1 个值,则选择一列不为空的行
- dart - Flutter 函数参数通过引用传递