[英]Upgrading Cordova caused Android Platform to stop working
I am using Ionic3: 我正在使用Ionic3:
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
I then upgraded my Cordova to the latest version (from 6.4.0
to 7.0.1
): 然后我将Cordova升级到最新版本(从
6.4.0
升级到7.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
As you can see, I also upgraded my Android platform from android 6.0.0
to android 6.2.3
. 如您所见,我还将Android平台从
android 6.0.0
升级到android 6.2.3
。
Since then, I cannot get my Cordova plugins to work on Android. 从那以后,我无法让我的Cordova插件在Android上运行。 iOS and browser all still works fine.
iOS和浏览器仍然可以正常工作。
If I run it on an Android device or emulator, it loads the app, but does not show the Splash Screen, or get the Geolocation, allow Firebase login, etc. It looks like all Cordova plugins for Android are not working. 如果我在Android设备或模拟器上运行它,它会加载应用程序,但不会显示启动画面,或者获取地理位置,允许Firebase登录等等。看起来所有适用于Android的Cordova插件都无法正常工作。
When I run in Android Studio, I get the following over and over in the logs: 当我在Android Studio中运行时,我会在日志中反复获得以下内容:
W/art: Attempt to remove non-JNI local reference, dumping thread
It appears as if the install of the latest Android Platform (6.2.3) has broken the app. 似乎安装最新的Android平台(6.2.3)已经破坏了应用程序。
Any suggestions welcome. 欢迎任何建议。
UPDATE UPDATE
Now I try uninstall the Android platform and reinstall version 6.0.0. 现在我尝试卸载Android平台并重新安装6.0.0版。 But I get errors:
但我得到错误:
cordova platform remove android
Removing platform android from config.xml file...
Richards-MacBook-Pro:theWhoZoo richardmarais$ ionic cordova platform add android@6.0.0
> cordova platform add android@6.0.0 --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 android@6.0.0 --save (exit code 1):
Using cordova-fetch for cordova-android@6.0.0
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 cordova-android@6.0.0
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
But: 但:
cordova platform ls
Installed platforms:
android 6.0.0
ios 4.3.1
then 然后
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
I check my Android SDK in Android Studio, and I have all the latest installed (Android 6.0, 7.0 & 7.1). 我在Android Studio中查看我的Android SDK,并且安装了所有最新版本(Android 6.0,7.0和7.1)。
So I upgrade back to the latest Android platform: 所以我升级回最新的Android平台:
cordova platform remove android
ionic cordova platform add android@latest
Now it builds again with no errors, but I sit with the same problem of the Cordova Plugins not working, and the following in the logs: 现在它再次构建没有错误,但我遇到了Cordova插件无法正常工作的问题,以及日志中的以下内容:
W/art: Attempt to remove non-JNI local reference, dumping thread
Solved: 解决了:
deleted node_modules
删除了
node_modules
npm install
ionic cordova platform remove android
ionic cordova platform add android@latest
ionic cordova build android
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.