Cordova run --debug building blank app

﹥>﹥吖頭↗ 提交于 2019-12-11 14:14:02

问题


I've built an app with ionic. When I use phonegap desktop program to run it on a server and view it on my phone it displays the app correctly however when I run

ionic platform add android
ionic build android
platforms\android\cordova\run --debug

The app which launches is the plain cordova app with blinking device is ready and title APACHE CORDOVA.

This is really annoying since I don't understand what is happening and how could this even happen. I am building the correct solution but the installed apk is something totally different. I don't even have a view that dislays that in my project files!!!!

EDIT I just found something completely unexpected. In platforms\android\assets\www the files are the original cordova blank app (the view that I see in device) but in my app www folder the files are totally. My guess is that cordova build android is not really building the correct app. What could be the cause of this and how can I fix it?

EDIT2 If I copy my ~/www content to platforms\android\assets\www then it will render the correct details. I'm still confused as to why cordova build does not copy the correct asset files to the relevant directory

EDIT3 If anyone else is experiencing the same problem take note that cordova is not copying or compiling any of the files in www folders. That goes for the plugins too. In order to install plugins you must do:

cordova plugin add <plugin-name> 

I am not aware of why this happens. It might be worth opening a ticket for the cordova team to fix this issue.


回答1:


If it blinks device is ready that means that the project is set up correctly. You have index.html file in www folder which contains that "view". And in that index.html file you will see two divs with two classes, one of them has "blink". Now you can delete that lines and start coding :)




回答2:


I have two suspects:

  1. Check your config.xml and point the src to your html file, default is index.html, which is the ready to print icon.

  2. You might perhaps be editing your project using an IDE that would copy the files and create a physically different project than where cordova folder is. Like eclipse. If you create new project in eclipse and import, it could copy the cordova project into eclipse workspace (based on some options if not carefully done)..So any edits done on the project will not be available from where you are launching:

    platforms\android\cordova\run --debug




回答3:


I was having the same issue. After digging around a bit, someone from the Ionic Forum suggested a workaround - downgrading Node to 4.2.2. It worked for me!



来源:https://stackoverflow.com/questions/33488341/cordova-run-debug-building-blank-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!