2017-10-09 92 views
1

當我嘗試使用ionic cordova run android --prod時,我目前在我的Ionic項目中遇到了這個奇怪的錯誤。我嘗試刪除和讀取平臺,刪除和讀取節點模塊,並切換npm和節點版本無濟於事。找不到與給定名稱匹配的資源:attr'android:keyboardNavigationCluster'

問題:有沒有人有任何想法如何解決這個神祕的問題?

C:\...\platforms\android\build\intermediates\res\merged\debug\values-v26\values-v26.xml:15: 

error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.

FAILED 

BUILD FAILED 

Total time: 26.595 secs 

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. 
Error: cmd: Command failed with exit code 1 Error output: 
Note: Some input files use or override a deprecated API. 
Note: Recompile with -Xlint:deprecation for details. 
Note: Some input files use or override a deprecated API. 
Note: Recompile with -Xlint:deprecation for details. 
C:\...\platforms\android\build\intermediates\res\merged\debug\values-v26\values-v26.xml:15:21-54: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'. 

C:\...\platforms\android\build\intermediates\res\merged\debug\values-v26\values-v26.xml:15: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'. 



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. 

[ERROR] An error occurred while running cordova run android (exit code 1). 
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below): 

cli packages: (C:…\node_modules) 

@ionic/cli-utils : 1.12.0 
ionic (Ionic CLI) : 3.12.0 
global packages: 

cordova (Cordova CLI) : 7.0.0 
local packages: 

@ionic/app-scripts : 3.0.0 
Cordova Platforms : android 6.2.3 
Ionic Framework : ionic-angular 3.7.1 
System: 

Android SDK Tools : 25.2.5 
Node    : v6.11.4 
npm    : 3.10.10 
OS    : Windows 10 
Misc: 

backend : legacy 

編輯:每請求,這是我的科爾多瓦插件

<plugin name="cordova-plugin-app-version" spec="^0.1.9" /> 
    <plugin name="cordova-plugin-camera" spec="^2.4.1"> 
    <plugin name="cordova-plugin-compat" spec="^1.2.0" /> 
    <plugin name="cordova-plugin-device" spec="^1.1.6" /> 
    <plugin name="cordova-plugin-file" spec="^4.3.3" /> 
    <plugin name="cordova-plugin-file-transfer" spec="^1.6.3" /> 
    <plugin name="cordova-plugin-filepath" spec="^1.1.0" /> 
    <plugin name="cordova-plugin-geolocation" spec="^2.4.3"> 
     <variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To determine geolocation for clock in/out purposes." /> 
    </plugin> 
    <plugin name="cordova-plugin-inappbrowser" spec="^1.7.1" /> 
    <plugin name="cordova-plugin-splashscreen" spec="^4.0.3" /> 
    <plugin name="cordova-plugin-statusbar" spec="^2.2.3" /> 
    <plugin name="cordova-plugin-whitelist" spec="^1.3.2" /> 
    <plugin name="cordova.plugins.diagnostic" spec="^3.6.8" /> 
    <engine name="android" spec="~6.2.3" /> 
+0

請問您可以添加您正在使用的cordova插件的列表嗎? – David

+0

完成@David,讓我知道你是否需要其他信息來診斷問題。 – Jason

回答

2

這是最有可能涉及到科爾多瓦診斷插件的列表。嘗試安裝版本3.7.1應該解決這個問題:

cordova plugin add [email protected] 

的根本原因是gradle這個正在尋找V26資源,它沒有找到。詳細解釋here

您可能還需要將cordova-android更新至版本6.3.0cordova platform add [email protected])並升級到最新的Android SDK工具(通過Android Studio)。當你這樣做時,不要忘記刪除cordova-plugin-compat

+0

我現在得到這個錯誤失敗的任務':transformClassesWithDexForDebug'。 > com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:com.android.dex.DexException:多個dex文件定義了Lorg/apache /科爾多瓦/ BuildHelper; 錯誤:cmd:命令失敗,退出代碼爲1錯誤輸出: 注意:某些輸入文件使用或覆蓋棄用的API。 注意:使用-Xlint:deprecation重新編譯以獲取詳細信息。 注意:某些輸入文件使用或覆蓋棄用的API。 注意:使用-Xlint:deprecation重新編譯以獲取詳細信息。 – Jason

+0

使用版本6.3.0時必須刪除cordova-plugin-compat,因爲它的代碼現在包含在cordova-android中。 'cordova plugin rm cordova-plugin-compat --force' – David

+0

現在我剛剛遇到這個問題> cordova prepare android 錯誤:找不到插件「cordova-plugin-compat」的plugin.xml。請嘗試再次添加它。 [錯誤]運行cordova prepare android(退出代碼1)時發生錯誤。 – Jason

相關問題