Search code examples
cordovaphonegap-pluginscordova-plugins

cordova project html files getting restore after installing plugins


I want to know one thing. When I install cordova project it has a default index.html page in assets folder. It's ok but after I changing code in index.html file, if i want to install any plugin in that project, every time index.html getting restore to default code. I can't understand why this is happening.

If this is a process of cordaova then I've to install all require plugins at first then I can continue the project. But in progress may be I need to install plugins so how can I keep my code safely in app project? This is a major thing to me. Please give me a proper way


Solution

  • You should not manipulate index.html file present under platform\android folder as this folder will be rebuilt every time when you build the android platform. You gotta make changes in index.html present under D:\myapp\www folder which gets copied to the respective platforms when you build them.

    UPDATE: You can directly edit the contents in platform\android folder and run the same for testing. But the moment you build it using cordova build android command, the contents from root folder gets copied to platform folder. Even if you directly manipulate contents under platform folder, you still gotta merge the changes back to root folder