【发布时间】:2017-05-26 18:40:36
【问题描述】:
我在 VS 2015 中构建 Cordova 应用程序时突然开始收到以下错误。Android SDK 中软件包的升级/删除导致了这个问题。
platforms\android\build\intermediates\res\merged\debug\values-v24\values-v24.xml:3 : AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
platforms\android\build\intermediates\res\merged\debug\values-v24\values-v24.xml:4 : AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
过去 4 天我已经尝试解决它,但没有成功。进行了以下尝试:
- 使用所有相应的第三方重新安装 VS 2015 应用程序
- 使用 VS 安装程序重新安装 Android SDK
- 从另一台编译相同源代码的计算机完成 Android SDK 传输
- 完全重新安装 Win10(3 次!),无论是否删除所有用户数据
- 清理 VS 2015 构建(无论是否包含我的原始 MS 用户) - 以避免 VS 恢复存储在我的帐户中的某些用户设置的可能性
- 安装其他 Android SDK 平台、附加功能、Google API、Android SDK 构建工具等。
- 使用 JDK 1.8.x 编译
- 使用 config.xml 中定义的不同 Target API 进行编译:16、23 和 24
- 删除依赖插件,例如 Cordova Compat 和 BarcodeScanner
- VS 2017 编译 - 无法抱怨缺少许可证。 Android SDK 中没有 Licenses 文件夹,因此我无法按照 Google 的说明从那里复制它
- 为高于 6.0.0 的 Cordova CLI 版本编译。较新的失败将与 VS 2017 出现相同的许可问题
- 在构建之前删除平台/插件/bower/node_modules 文件夹
- 将源代码移至根文件夹以缩短路径
完全相同的新源代码会为我的朋友编译并在另一台计算机上为我编译。
有时它确实为我编译,没有进行任何更改。在这些情况下,出于某种原因,不会为 ARM/x86 生成单独的包。它们应该是在嵌入式模式下使用 Crosswalk 项目的结果..
构建失败
1> ------ Building platform: android
1> Debug
1> ------ Build configuration options: --debug
1> Executing "before_compile" hook for all plugins.
1> ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
1> JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_55
1> null
1> org.xwalk:xwalk_core_library:20+
1> :preBuild UP-TO-DATE
1> :preArmv7DebugBuild UP-TO-DATE
1> :checkArmv7DebugManifest
1> :preX86DebugBuild UP-TO-DATE
1> :CordovaLib:preBuild UP-TO-DATE
1> :CordovaLib:preDebugBuild UP-TO-DATE
1> :CordovaLib:compileDebugNdk UP-TO-DATE
1> :CordovaLib:compileLint
1> :CordovaLib:copyDebugLint UP-TO-DATE
1> :CordovaLib:mergeDebugProguardFiles
1> :CordovaLib:packageDebugRenderscript UP-TO-DATE
1> :CordovaLib:checkDebugManifest
1> :CordovaLib:prepareDebugDependencies
1> :CordovaLib:compileDebugRenderscript
1> :CordovaLib:generateDebugResValues
1> :CordovaLib:generateDebugResources
1> :CordovaLib:packageDebugResources
1> :CordovaLib:compileDebugAidl
1> :CordovaLib:generateDebugBuildConfig
1> :CordovaLib:generateDebugAssets UP-TO-DATE
1> :CordovaLib:mergeDebugAssets
1> :CordovaLib:processDebugManifest
1> :CordovaLib:processDebugResources
1> :CordovaLib:generateDebugSources
1>MSBUILD : cordova-build warning : Note: Some input files use or override a deprecated API.
1> Note: Some input files use or override a deprecated API.
1>MSBUILD : cordova-build warning : Note: Recompile with -Xlint:deprecation for details.
1> Note: Recompile with -Xlint:deprecation for details.
1> :CordovaLib:compileDebugJavaWithJavac
1> :CordovaLib:processDebugJavaRes UP-TO-DATE
1> :CordovaLib:transformResourcesWithMergeJavaResForDebug
1> :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
1> :CordovaLib:mergeDebugJniLibFolders
1> :CordovaLib:transformNative_libsWithMergeJniLibsForDebug
1> :CordovaLib:transformNative_libsWithSyncJniLibsForDebug
1> :CordovaLib:bundleDebug
1> :prepareAndroidCordovaLibUnspecifiedDebugLibrary
1> :preArmv7ReleaseBuild UP-TO-DATE
1> :preX86ReleaseBuild UP-TO-DATE
1> :CordovaLib:preReleaseBuild UP-TO-DATE
1> :CordovaLib:compileReleaseNdk UP-TO-DATE
1> :CordovaLib:copyReleaseLint UP-TO-DATE
1> :CordovaLib:mergeReleaseProguardFiles
1> :CordovaLib:packageReleaseRenderscript UP-TO-DATE
1> :CordovaLib:checkReleaseManifest
1> :CordovaLib:prepareReleaseDependencies
1> :CordovaLib:compileReleaseRenderscript
1> :CordovaLib:generateReleaseResValues
1> :CordovaLib:generateReleaseResources
1> :CordovaLib:packageReleaseResources
1> :CordovaLib:compileReleaseAidl
1> :CordovaLib:generateReleaseBuildConfig
1> :CordovaLib:generateReleaseAssets UP-TO-DATE
1> :CordovaLib:mergeReleaseAssets
1> :CordovaLib:processReleaseManifest
1> :CordovaLib:processReleaseResources
1> :CordovaLib:generateReleaseSources
1>MSBUILD : cordova-build warning : Note: Some input files use or override a deprecated API.
1> Note: Some input files use or override a deprecated API.
1>MSBUILD : cordova-build warning : Note: Recompile with -Xlint:deprecation for details.
1> Note: Recompile with -Xlint:deprecation for details.
1> :CordovaLib:compileReleaseJavaWithJavac
1> :CordovaLib:processReleaseJavaRes UP-TO-DATE
1> :CordovaLib:transformResourcesWithMergeJavaResForRelease
1> :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease
1> :CordovaLib:mergeReleaseJniLibFolders
1> :CordovaLib:transformNative_libsWithMergeJniLibsForRelease
1> :CordovaLib:transformNative_libsWithSyncJniLibsForRelease
1> :CordovaLib:bundleRelease
1> :prepareBarcodescannerLibrary
1> :prepareComAndroidSupportAnimatedVectorDrawable2510Library
1> :prepareComAndroidSupportAppcompatV72510Library
1> :prepareComAndroidSupportSupportCompat2510Library
1> :prepareComAndroidSupportSupportCoreUi2510Library
1> :prepareComAndroidSupportSupportCoreUtils2510Library
1> :prepareComAndroidSupportSupportFragment2510Library
1> :prepareComAndroidSupportSupportMediaCompat2510Library
1> :prepareComAndroidSupportSupportV42510Library
1> :prepareComAndroidSupportSupportVectorDrawable2510Library
1> :prepareOrgXwalkXwalk_core_library205053312Library
1> :prepareArmv7DebugDependencies
1> :compileArmv7DebugAidl
1> :compileArmv7DebugRenderscript
1> :generateArmv7DebugBuildConfig
1> :generateArmv7DebugAssets UP-TO-DATE
1> :mergeArmv7DebugAssets
1> :createXwalkCommandLineFileArmv7Debug
1> :generateArmv7DebugResValues
1> :generateArmv7DebugResources
1>MSBUILD : cordova-build error : AAPT err(Facade for 8377832): platforms\android\build\intermediates\exploded-aar\barcodescanner\res\drawable\toggle_torch.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
1> AAPT err(Facade for 8377832): platforms\android\build\intermediates\exploded-aar\barcodescanner\res\drawable\toggle_torch.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
1> :mergeArmv7DebugResources
1> :processArmv7DebugManifest
1>MSBUILD : cordova-build error : platforms\android\build\intermediates\res\merged\armv7\debug\values-v24\values-v24.xml:3 : AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
1> platforms\android\build\intermediates\res\merged\armv7\debug\values-v24\values-v24.xml:3 : AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
1>
1> :processArmv7DebugResources FAILED
1>MSBUILD : cordova-build error : platforms\android\build\intermediates\res\merged\armv7\debug\values-v24\values-v24.xml:4 : AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
1> platforms\android\build\intermediates\res\merged\armv7\debug\values-v24\values-v24.xml:4 : AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
1>
1>
1>MSBUILD : cordova-build error : FAILURE: Build failed with an exception.
1> FAILURE: Build failed with an exception.
1>
1>MSBUILD : cordova-build error : * What went wrong:
1> * What went wrong:
1>MSBUILD : cordova-build error : Execution failed for task ':processArmv7DebugResources'.
1> Execution failed for task ':processArmv7DebugResources'.
1>
1> BUILD FAILED
1>
1> Total time: 23.263 secs
1>MSBUILD : cordova-build error : > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.1\aapt.exe'' finished with non-zero exit value 1
1> > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.1\aapt.exe'' finished with non-zero exit value 1
1>
1>MSBUILD : cordova-build error : * Try:
1> * Try:
1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
1> Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
1> ERROR building one of the platforms: Error code 1 for command: cmd with args: /s,/c,"platforms\android\gradlew cdvBuildDebug -b platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
1> You may not have the required environment or OS to build this project
1>MSBUILD : cordova-build error : Error code 1 for command: cmd with args: /s,/c,"platforms\android\gradlew cdvBuildDebug -b platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
1> Error code 1 for command: cmd with args: /s,/c,"platforms\android\gradlew cdvBuildDebug -b platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
构建失败和构建成功的区别始于prepareBarcodescannerLibrary之后。
成功构建
1> :prepareBarcodescannerLibrary
1> :prepareComAndroidSupportAppcompatV72221Library
1> :prepareComAndroidSupportSupportV42221Library
1> :prepareOrgXwalkXwalk_core_library205053312Library
1> :prepareArmv7DebugDependencies
1> :compileArmv7DebugAidl
1> :compileArmv7DebugRenderscript
1> :generateArmv7DebugBuildConfig
1> :generateArmv7DebugAssets UP-TO-DATE
1> :mergeArmv7DebugAssets
1> :createXwalkCommandLineFileArmv7Debug
1> :generateArmv7DebugResValues
1> :generateArmv7DebugResources
1>MSBUILD : cordova-build error : AAPT err(Facade for 24487251): platforms\android\build\intermediates\exploded-aar\barcodescanner\res\drawable\toggle_torch.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
1> AAPT err(Facade for 24487251): platforms\android\build\intermediates\exploded-aar\barcodescanner\res\drawable\toggle_torch.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
1> :mergeArmv7DebugResources
1> :processArmv7DebugManifest
1> :processArmv7DebugResources
1> :generateArmv7DebugSources
1>MSBUILD : cordova-build warning : Note: Some input files use or override a deprecated API.
1> Note: Some input files use or override a deprecated API.
1>MSBUILD : cordova-build warning : Note: Recompile with -Xlint:deprecation for details.
1> Note: Recompile with -Xlint:deprecation for details.
1>MSBUILD : cordova-build warning : Note: platforms\android\src\cordova\plugins\Diagnostic.java uses unchecked or unsafe operations.
1> Note: platforms\android\src\cordova\plugins\Diagnostic.java uses unchecked or unsafe operations.
1>MSBUILD : cordova-build warning : Note: Recompile with -Xlint:unchecked for details.
1> Note: Recompile with -Xlint:unchecked for details.
1> :compileArmv7DebugJavaWithJavac
1> :compileArmv7DebugNdk UP-TO-DATE
1> :compileArmv7DebugSources
1>
1> :transformClassesWithDexForArmv7Debug
1> :mergeArmv7DebugJniLibFolders
1> :transformNative_libsWithMergeJniLibsForArmv7Debug
1> :processArmv7DebugJavaRes UP-TO-DATE
显然库的版本是不同的。但是我想不出如何解决这个问题。
config.xml 插件
<preference name="android-minSdkVersion" value="16" />
<feature name="Keyboard">
<param name="ios-package" onload="true" value="IonicKeyboard" />
</feature>
<plugin name="cordova-sqlite-storage" src="https://github.com/litehelpers/Cordova-sqlite-storage.git" version="0.7.15-pre" />
<plugin name="cordova-sqlite-storage" version="0.7.15-pre" />
<plugin name="phonegap-plugin-barcodescanner" src="https://github.com/phonegap/phonegap-plugin-barcodescanner" version="6.0.1" />
<plugin name="cordova-plugin-whitelist" version="1.2.1" />
<plugin name="ionic-plugin-keyboard" src="https://github.com/driftyco/ionic-plugin-keyboard.git" version="2.0.1" />
<plugin name="cordova-plugin-geolocation" version="2.1.0" />
<plugin name="cordova-plugin-app-version" src="https://github.com/whiteoctober/cordova-plugin-app-version.git" version="0.1.8" />
<plugin name="cordova-plugin-compat" version="1.0.0" />
<plugin name="cordova-plugin-device" version="1.1.2" />
<plugin name="cordova-plugin-inappbrowser" version="1.2.1" />
<plugin name="cordova-plugin-crosswalk-webview" version="2.1.0" />
<plugin name="cordova.plugins.diagnostic" version="3.3.2" />
<plugin name="phonegap-plugin-barcodescanner" version="6.0.4">
<variable name="CAMERA_USAGE_DESCRIPTION" value="Barcode scanning" />
</plugin>
<plugin name="cordova-custom-config" version="3.1.2" />
<preference name="xwalkVersion" value="20+" />
<preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect" />
<preference name="xwalkMode" value="embedded" />
<!-- <preference name="xwalkMode" value="shared" /> -->
<preference name="xwalkMultipleApk" value="true" />
bower.json
{
"name": "project_name",
"devDependencies": {
"angular": "~1.6.0",
"angular-animate": "~1.6.0",
"angular-messages": "~1.6.0",
"angular-resource": "~1.6.0",
"angular-sanitize": "~1.6.0",
"angular-ui-router": "^0.3.2",
"ionic": "^1.3.2",
"ngEnter": "^0.0.1",
"ngstorage": "^0.3.11",
"ngtouch": "^1.0.1",
"underscore-min": "^1.8.3"
},
"resolutions": {
"angular": "~1.6.0",
"angular-sanitize": "~1.6.0",
"angular-resource": "~1.6.0",
"angular-animate": "~1.6.0",
"angular-ui-router": "^0.3.2"
}
}
plugins\fetch.json
{
"cordova-sqlite-storage": {
"source": {
"type": "git",
"url": "https://github.com/litehelpers/Cordova-sqlite-storage.git",
"subdir": "."
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-whitelist": {
"source": {
"type": "registry",
"id": "cordova-plugin-whitelist@1.2.1"
},
"is_top_level": true,
"variables": {}
},
"ionic-plugin-keyboard": {
"source": {
"type": "git",
"url": "https://github.com/driftyco/ionic-plugin-keyboard.git",
"subdir": "."
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-geolocation": {
"source": {
"type": "registry",
"id": "cordova-plugin-geolocation@2.1.0"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-app-version": {
"source": {
"type": "git",
"url": "https://github.com/whiteoctober/cordova-plugin-app-version.git",
"subdir": "."
},
"is_top_level": true,
"variables": {}
},
"phonegap-plugin-barcodescanner": {
"source": {
"type": "git",
"url": "https://github.com/phonegap/phonegap-plugin-barcodescanner",
"subdir": "."
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-compat": {
"source": {
"type": "registry",
"id": "cordova-plugin-compat@1.0.0"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-device": {
"source": {
"type": "registry",
"id": "cordova-plugin-device@1.1.2"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-inappbrowser": {
"source": {
"type": "registry",
"id": "cordova-plugin-inappbrowser@1.2.1"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-crosswalk-webview": {
"source": {
"type": "registry",
"id": "cordova-plugin-crosswalk-webview@2.1.0"
},
"is_top_level": true,
"variables": {
"XWALK_VERSION": "21+",
"XWALK_LITEVERSION": "xwalk_core_library_canary:17+",
"XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect",
"XWALK_MODE": "embedded",
"XWALK_MULTIPLEAPK": "true"
}
},
"cordova.plugins.diagnostic": {
"source": {
"type": "registry",
"id": "cordova.plugins.diagnostic@3.3.2"
},
"is_top_level": true,
"variables": {}
},
"cordova-custom-config": {
"source": {
"type": "registry",
"id": "cordova-custom-config@3.1.2"
},
"is_top_level": true,
"variables": {}
}
}
plugins\android.json(自动生成)
{
"prepare_queue": {
"installed": [],
"uninstalled": []
},
"config_munge": {
"files": {}
},
"installed_plugins": {
"cordova-custom-config": {
"PACKAGE_NAME": "io.cordova.myappe2785d518e9f4f6ea03055878dd7a400"
},
"cordova-plugin-app-version": {
"PACKAGE_NAME": "io.cordova.myappe2785d518e9f4f6ea03055878dd7a400"
},
"cordova-plugin-compat": {
"PACKAGE_NAME": "io.cordova.myappe2785d518e9f4f6ea03055878dd7a400"
},
"cordova-plugin-crosswalk-webview": {
"XWALK_VERSION": "21+",
"XWALK_LITEVERSION": "xwalk_core_library_canary:17+",
"XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect",
"XWALK_MODE": "embedded",
"XWALK_MULTIPLEAPK": "true",
"PACKAGE_NAME": "io.cordova.myappe2785d518e9f4f6ea03055878dd7a400"
},
"cordova-plugin-device": {
"PACKAGE_NAME": "io.cordova.myappe2785d518e9f4f6ea03055878dd7a400"
},
"cordova-plugin-geolocation": {
"PACKAGE_NAME": "io.cordova.myappe2785d518e9f4f6ea03055878dd7a400"
},
"cordova-plugin-inappbrowser": {
"PACKAGE_NAME": "io.cordova.myappe2785d518e9f4f6ea03055878dd7a400"
},
"cordova-plugin-whitelist": {
"PACKAGE_NAME": "io.cordova.myappe2785d518e9f4f6ea03055878dd7a400"
},
"cordova-sqlite-storage": {
"PACKAGE_NAME": "io.cordova.myappe2785d518e9f4f6ea03055878dd7a400"
},
"cordova.plugins.diagnostic": {
"PACKAGE_NAME": "io.cordova.myappe2785d518e9f4f6ea03055878dd7a400"
},
"ionic-plugin-keyboard": {
"PACKAGE_NAME": "io.cordova.myappe2785d518e9f4f6ea03055878dd7a400"
},
"phonegap-plugin-barcodescanner": {
"PACKAGE_NAME": "io.cordova.myappe2785d518e9f4f6ea03055878dd7a400"
}
},
"dependent_plugins": {}
}
package.json
{
"name": "project_name",
"version": "1.0.0",
"devDependencies": {
"elementtree": "^0.1.6",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.1",
"gulp-uglify": "^2.0.0",
"plist": "^2.0.1",
"tostr": "^0.1.0",
"xcode": "^0.9.0",
"ng-cordova": "^0.1.27-alpha",
"lodash": "4.17.4"
},
"dependencies": {}
}
【问题讨论】:
-
您使用什么插件或库?您的目标是哪个 Android API 级别?
-
我已经用您询问的信息更新了问题。我已经尝试在 config.xml 中针对 API 16、23 和 24 定位它,但它没有改变任何东西。
-
所以,这个问题与 cordova.plugins.diagnostic 插件有关。删除后,项目再次编译。但是我怎样才能让我的环境回到它编译的前一个状态呢?主要区别似乎在于 appcompat 库。
-
能否请您尝试删除android平台并重新构建?
-
我已经尝试过了(删除了 VS 中的
platforms文件夹)并且它没有改变任何东西。在插件作者解决问题之前,我认为最好的解决方法是将 Android Support Repository 降级为 rev。 github.com/dpa99c/cordova-diagnostic-plugin/issues/168
标签: visual-studio cordova visual-studio-2015 android-appcompat