如何解决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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。