When I run ionic build android
from my project’s directory, it copies a version of my app from like 6 weeks ago in the platforms/android folder. Here are steps I’ve tried to rectify this issue:
- I’ve deleted some of the files that were used in this old build, including deleting them from /platforms/android and both myapp/src and myapp/www, and somehow the
ionic build android
command recovers these files from god knows where and copies them into the platforms/android folder. - I’ve tried updating my version number in my config.xml file.
- I’ve tried deleting the APK and various other files from /build/android as well as deleting the entire platforms/android folder and the entire platforms folder.
- I’ve uninstalled and reinstalled both ionic and cordova (
npm install/uninstall -g ionic/cordova
) - I tried creating a new ionic app with ionic start and then after cding into the new directory for my new project and running the same two commands, I got the old version of my other app. Messed up!
- I’ve tried removing and then adding back cordova android with both the commands
ionic cordova platform rm/add android
andcordova platform rm/add android
.
I’m at my wit’s end here. Here’s ionic info:
cli packages: (C:\Users\max\Documents\omsLibrary\node_modules)
@ionic/cli-utils : 1.13.1
ionic (Ionic CLI) : 3.13.1
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
@ionic/app-scripts : 1.3.7
Cordova Platforms : android
Ionic Framework : ionic-angular 3.7.1
System:
Android SDK Tools : 26.1.1
Node : v6.9.2
npm : 5.4.2
OS : Windows 10
Misc:
backend : pro
The one weird thing I’m seeing is
C:\Users\max\Documents\omsLibrary>ionic cordova platforms add android
> cordova platform add android --save
× Running command - failed!
[WARN] Platform already added. Saving platforms to config.xml.
> cordova platform save
√ Running command - done!
> ionic cordova resources android --force
√ Collecting resource configuration and source images - done!
? Platform android not detected. Would you like to install it? Yes
> cordova platform add android --save
× Running command - failed!
[WARN] Platform already added. Saving platforms to config.xml.
> cordova platform save
√ Running command - done!
[ERROR] No platforms detected. Please run: ionic cordova platform add
If I run it again, the loop starts over, so I look in the platforms/android folder, and it looks like it installed, so I run ionic cordova build android
and everything seems fine except for this note at the top:
C:\Users\max\Documents\omsLibrary>ionic cordova build android
> cordova platform add android --save
× Running command - failed!
[WARN] Platform already added. Saving platforms to config.xml.
> cordova platform save
√ Running command - done!
Once again it’s trying to add the platform. Once again, it’s realizing it has the platform. Sigh. I wouldn’t care about this issue if the build still worked, but of course, there’s that big problem of the compiled app not being copied into the build/android folder. When I copy over the contents of myapp/www into platforms/android/assets/www/build
, and then open the android directory in Android Studio, it does recompile into my latest app, but I don’t want to have to go through all of that every time I want to test something on Android!
Please, any help is appreciated. My best guess is this has something to do with some sort of busted caching in cordova or ionic, but I can’t find any information on that.