2017-06-02 112 views
0

我使用Ionic3:升級科爾多瓦引起的Android平臺停止工作

global packages: 

    @ionic/cli-utils : 1.3.0 
    Cordova CLI  : 6.4.0 
    Ionic CLI  : 3.3.0 

local packages: 

    @ionic/app-scripts    : 1.3.0 
    @ionic/cli-plugin-cordova  : 1.3.0 
    @ionic/cli-plugin-ionic-angular : 1.3.0 
    Cordova Platforms    : android 6.0.0 ios 4.3.1 
    Ionic Framework     : ionic-angular 3.2.1 

System: 

    Node  : v7.10.0 
    OS   : macOS Sierra 
    Xcode  : Xcode 8.3.2 Build version 8E2002 
    ios-deploy : not installed 
    ios-sim : not installed 

然後我升級我的科爾多瓦到最新版本(從6.4.07.0.1):

global packages: 

    @ionic/cli-utils : 1.3.0 
    Cordova CLI  : 7.0.1 
    Ionic CLI  : 3.3.0 

local packages: 

    @ionic/app-scripts    : 1.3.0 
    @ionic/cli-plugin-cordova  : 1.3.0 
    @ionic/cli-plugin-ionic-angular : 1.3.0 
    Cordova Platforms    : android 6.2.3 ios 4.3.1 
    Ionic Framework     : ionic-angular 3.2.1 

System: 

    Node  : v7.10.0 
    OS   : macOS Sierra 
    Xcode  : Xcode 8.3.2 Build version 8E2002 
    ios-deploy : not installed 
    ios-sim : not installed 

正如你所看到的,我也將我的Android平臺從android 6.0.0升級到android 6.2.3

從那時起,我無法讓我的Cordova插件在Android上工作。 iOS和瀏覽器仍然正常工作。

如果我在Android設備或模擬器上運行它,它會加載應用程序,但不會顯示啓動畫面,或獲取地理位置,允許Firebase登錄等。它看起來像Android的所有科爾多瓦插件不工作。

當我在Android Studio中運行,我得到在日誌下面一遍又一遍:

W/art: Attempt to remove non-JNI local reference, dumping thread 

看起來好像安裝了最新的Android平臺(6.2.3)已打破了應用程序。

歡迎任何建議。

UPDATE

現在我嘗試卸載Android平臺,並重新安裝6.0.0版。但我得到的錯誤:

cordova platform remove android 
Removing platform android from config.xml file... 
Richards-MacBook-Pro:theWhoZoo richardmarais$ ionic cordova platform add [email protected] 
> cordova platform add [email protected] --save 
✖ Running command - failed! 

[ERROR] Cordova encountered an error. 
     You may get more insight by running the Cordova command above directly. 

[ERROR] An error occurred while running cordova platform add [email protected] --save (exit code 1): 

     Using cordova-fetch for [email protected] 
     Adding android project... 
     Creating Cordova project for the Android platform: 
      Path: platforms/android 
      Package: com.ionicframework.thewhozoo912107 
      Name: theWhoZoo 
      Activity: MainActivity 
      Android target: android-24 
     Subproject Path: CordovaLib 
     Android project created with [email protected] 
     Installing "cordova-plugin-app-version" for android 
     ANDROID_HOME=/Users/richardmarais/Library/Android/sdk/ 
     JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home 
     Failed to install 'cordova-plugin-app-version': Error 
      at Object.module.exports.check_gradle (/Users/richardmarais/Development/ionic/theWhoZoo/platforms/android/cordova/lib/check_reqs.js:90:25) 
      at GradleBuilder.prepEnv (/Users/richardmarais/Development/ionic/theWhoZoo/platforms/android/cordova/lib/builders/GradleBuilder.js:161:23) 
      at Api.module.exports.runClean (/Users/richardmarais/Development/ionic/theWhoZoo/platforms/android/cordova/lib/build.js:131:20) 
      at /Users/richardmarais/Development/ionic/theWhoZoo/platforms/android/cordova/Api.js:391:50 
      at _fulfilled (/Users/richardmarais/Development/ionic/theWhoZoo/platforms/android/cordova/node_modules/q/q.js:834:54) 
      at self.promiseDispatch.done (/Users/richardmarais/Development/ionic/theWhoZoo/platforms/android/cordova/node_modules/q/q.js:863:30) 
      at Promise.promise.promiseDispatch (/Users/richardmarais/Development/ionic/theWhoZoo/platforms/android/cordova/node_modules/q/q.js:796:13) 
      at /Users/richardmarais/Development/ionic/theWhoZoo/platforms/android/cordova/node_modules/q/q.js:604:44 
      at runSingle (/Users/richardmarais/Development/ionic/theWhoZoo/platforms/android/cordova/node_modules/q/q.js:137:13) 
      at flush (/Users/richardmarais/Development/ionic/theWhoZoo/platforms/android/cordova/node_modules/q/q.js:125:13) 
     Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK. 
     Looked here: /Users/richardmarais/Library/Android/sdk/tools/templates/gradle/wrapper 

但是:

cordova platform ls 
Installed platforms: 
    android 6.0.0 
    ios 4.3.1 

然後

cordova build android 
✖ Running command - failed! 

[ERROR] Cordova encountered an error. 
     You may get more insight by running the Cordova command above directly. 

[ERROR] An error occurred while running cordova build android (exit code 1): 

     ANDROID_HOME=/Users/richardmarais/Library/Android/sdk/ 
     JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home 
     Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK. 
     Looked here: /Users/richardmarais/Library/Android/sdk/tools/templates/gradle/wrapper 

檢查我的Android SDK Android Studio中,我都安裝了最新的(在Android 6.0,7.0 & 7.1)。

所以我升級還原到最新的Android平臺:

cordova platform remove android 
ionic cordova platform add [email protected] 

現在沒有錯誤再次建立,但我坐在插件不工作,並在日誌下面的科爾多瓦同樣的問題:

W/art: Attempt to remove non-JNI local reference, dumping thread

回答

0

解決:

刪除node_modules

npm install 

ionic cordova platform remove android 
ionic cordova platform add [email protected] 

ionic cordova build android