在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天解决它,但没有成功。进行了以下尝试:
完全一样,新的源代码为我的朋友编译,并在另一台计算机上为我编译。
有时它会为我编译,不做任何更改。在这些情况下,由于某种原因,不会生成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"
}
}
插件\ 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": {}
}
答案 0 :(得分:2)
感谢 dpa99c 的指导 - cordova.plugins.diagnostic
插件的作者,您可以在下面找到上述问题的解决方案。您可以在GitHub上找到更多详细信息和讨论。
此问题是由Android SDK Manager中的Android Support Repository
升级为rev. 41
引起的。
解决方案1 - 短期
将Android Support Repository
还原为rev. 16
。除了从另一台计算机复制之外,我不知道这样做的任何方式。就我而言,它位于c:\Program Files (x86)\Android\android-sdk\extras\android\m2repository
。
解决方案2 - 短期
将cordova.plugins.diagnostic
插件降级到版本3.0.0,由@JuanSánchez提供。该插件的3.2版增加了对iOS 10的支持,很难。
解决方案3 - 长期
bin
,bld
,Merge
和platforms
文件夹。config.xml
,将Cordova CLI更改为6.4.0+。您可以在Platforms
群组中找到它。SDK
。它将为您提供编译项目的Android SDK版本号。就我而言,它是第24版。c:\Program Files (x86)\Android\android-sdk\tools
。它可能因您的设置而异。android update sdk --no-ui --filter build-tools-24.0.3,android-24
。请将版本号更改为构建输出中列出的Android SDK版本。解决方案来自from SO。_JAVA_OPTIONS=-Xmx512M
中定义以下环境变量。如果需要,请使用更大的数字。解决方案来自from SO。执行上述步骤后,所有内容都应该使用最新版本的cordova.plugins.diagnostic
编译。
答案 1 :(得分:0)
解决此问题的最简单方法是将cordova.plugins.diagnostic降级到版本3.0.0,如here所述
它对我有用。