這是一個 com.android.support:support-v4
包不合適的錯誤
phonegap-plugin-barcodescanner
爲例。diners-barcodescanner.gradle
文件裏面 compile 'com.android.support:support-v4:+'
改爲 compile 'com.android.support:support-v4:27+'
應該能好。
Android 目錄下面 project.properties
裏面也有類似配置。但是一般改插件裏面的比較好吧。
➜ A git:(master) ✗ cordova build android
CHCP plugin after prepare hook:
config-file set to http://.../www/chcp.json
ANDROID_HOME=/Users/felix/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
Subproject Path: CordovaLib
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_3j0awvevr86fmrv4tdel4mctj.run(/.../platforms/android/build.gradle:143)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
:preBuild UP-TO-DATE
... 省略 ...
:processDebugManifest UP-TO-DATE
:processDebugResourcesERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:ttcIndex
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.564 secs
(node:31458) UnhandledPromiseRejectionWarning: Error: /.../platforms/android/gradlew: Command failed with exit code 1 Error output:
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:ttcIndex
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
at ChildProcess.whenDone (/.../platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at ChildProcess.emit (events.js:159:13)
at maybeClose (internal/child_process.js:943:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:31458) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:31458) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
➜ A git:(master) ✗ cordova build android
CHCP plugin after prepare hook:
config-file set to http://.../www/chcp.json
ANDROID_HOME=/Users/felix/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
Subproject Path: CordovaLib
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_3j0awvevr86fmrv4tdel4mctj.run(/.../platforms/android/build.gradle:143)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
:preBuild UP-TO-DATE
... 省略 ...
:cdvBuildDebug
BUILD SUCCESSFUL
Total time: 18.579 secs
Built the following apk(s):
/.../platforms/android/build/outputs/apk/android-debug.apk