I can't find something about this, I am create a cordova project with NodeJS/npm, see this link, But after create the project I will try to modify him, its like a normal thing to do.
I tryed to edit the file in:
C:\Program Files\nodejs\helloworld\platforms\android\assets\www\index.html
and run this code in console:
cordova emulate android
my files are reloading and my modifications are deleted, the application are deployed into emulator and I can't do nothing. How I can edit my project without this "reloader"? What I am doing wrong?
modify here
C:\Program Files\nodejs\helloworld\www\index.html
This modification will be automatically applied to the platform's asset folder after you build the project. And build project first before emulate
cordova build android
Related
I'm following the cordova tutorial on how to embed a cordova project onto a larger android app: https://cordova.apache.org/docs/en/latest/guide/platforms/android/webview.html
After setting up the cordova project, adding android as a platform and running it, im stuck at step 2.
I go to %projectpath%\MyApp\node_modules\cordova-android\framework and run the "ant jar" command, but it tells me build.xml doesn't exist.
I searched my computer for a build.xml file but I can't find any file named like that.
cmd error picture
Am I doing something wrong or using an incorrect folder?
I am developing a flutter app for both iOS and Android. When generating the APK, I prefer to use Android studio (my default IDE is VSCODE). However, when I go to Tools > Flutter I do not see Open Android Module in Android Studio option. I do see Open iOS Module in Xcode.
I followed couple of SO answers, even tried replacing android.iml file from a working project. Nothing happened. I re-cloned my project from BitBucket because sometimes the Android Studio was fine when the project is freshly from repo, but this time, that didn't work either.
I Also tried opening the gradle file and looking for the option (as explained in one SO answer), that didn't work too.
However I noticed, few issues.
In the folder structure, the root folder is replaced by the flutter icon. in projects where I have no issues with, the folder icon is folder.
In here I see .dart_tool folder. In working apps with no issue, I do not see this folder.
I do not have an android.iml file. In other projects I did.
Below is my folder structure in a nutshell. Whats going on here and how to fix this issue?
When you don't see any options to
open module in android studio
because of missing .iml files caused by .gitignore file, follow simple steps.
Click on File and choose Open..
Now in the opened dialog choose android folder of example flutter project under your plugin module. For e.g if test is your plugin with example as it's app then you need to select and click Ok
test\example\android
3. Then wait for Android Studio to sync and download necessary jar files.
Simplest solution
Open flutter project
Go to android folder
open manfiest file
On the top right you will see option open module in android studio
click on this option
Solution 2:-
Import your android project as a project in android studio
The easiest way is to use this command in the root directory of your project, it will create some missing files and it will definitely work.
flutter create --platforms=android .
Now just right click to Android folder
I'm trying out Phonegap using both the command line and with Intellij IDEA.
When I create a new 'hello world'-project with
phonegap create . com.example.test Test
a folder www is created with all html-files. I'm told this is the place where you should do the changes to the source code.
But when I do 'phonegap local build android' the contents of this folder is copied to 'platforms/android/assets/www'. I assume this is done by ant.
Now I want to use only Intellij IDEA for the building instead of the command line. I already managed to import the project into IDEA and run it, but only AFTER I did a local build using the command line first, so I assume IDEA found the copied 'assets/www' files to do the building/running.
Somehow it must be possible with Intellij IDEA to edit the normal www in the root but then when running, do exactly the same as phonegap local build does, but I can't figure out how.
Im new with phonegap, cordova and android. Im on mac, recently i install all the needs:
Phonegap 3.3.0-0.19.6
Cordova 3.3.1-0.4.1
Got Android SDK and running on eclipse with no problem. Then create a new Android application on eclipse for phonegap successfully, and running on a phone with android.
Then i create another app with cordoba(terminal), put 2 platforms android and ios, i run prepare etc.. and then import the project(android) into eclipse. At this point the app runs ok, so i proceed to install some plugins for testing (Notifications and Device)
https://cordova.apache.org/docs/en/3.0.0/cordova_device_device.md.html#Device
When i run the app with eclipse the examples always return
Uncaught TypeError: Cannot call method 'alert' of undefined
And its the same with device. So looking over the internet i found that if i run $cordova prepare will work, then i run the command, then run the app on eclipse and it work but always when i install a new plugin for testing i have to run cordova prepare, and the problem is that index.html rewrite with example hello world and i loose my code.
Any help over here, im doing ok?, how to install those plugins and make the test and dont have to run prepare all the time. (Please think on eclipse, i dont what to use terminal all the time)
I had the same exact problem and other posts suggestions didn't work for me.
I solved it by switching the steps a bit, despite the official docs and other posts.
If I add ALL the files AND the core plugins BEFORE I add the platforms, then adding the platforms takes these things with it into the new folder structures AND only build once from the command line before I open the project.
If I need to add anything I do it again. Although I can edit the www files without going through the process again, I do not expect the root www to perpetuate the platform www's. I just copy it myself into all the www folders. It shouldn't be this way but I think this is a well documented bug with multiple command line builds, for now and thats my working fix.
The recommended way is to edit html/js/css... in the root www folder of the project, not in the platfotms/xxx folders.
The reason is that if you have multiple platforms, you just need to modify in one place and cordova prepare or cordova build or phonegap build will propagate your code to all the platforms and update plugins.
If you have only android platform and want to be able to change code directly in eclipse for the platforms/android/assets/www folder, I suggest you create a shell script to
copy all the content of projectroot/platforms/android/assets/www to projectroot/www
run cordova prepare android
Then, instead of running cordova prepare android, you'll just have to run your script after you add new plugins.
Edit
I think there may be a better way for your problem.
You should be able to use plugman to install your plugins instead of cordova.
First you need to install plugman cli : npm install -g plugman
then install a plugin using
plugman -d --platform android --project projectname --plugin nameorurlofplugin
http://cordova.apache.org/docs/en/edge/plugin_ref_plugman.md.html
I had these issues too.
One approach I use now is:
Edit the index.html in the platform folders which is platform/iOS/appname/www and so. Then add plugins using the normal terminal way using cordova plugin add but always run the project using Xcode for iOS and eclipse and not from the terminal because then you will lose your code.
From my experience when you run using .xcodeproj or say android project the www on the inside is used and if you use cordova run ios from terminal the www on the outside will overwrite the www in the platform folders.
If you get xcode errors saying can't find so and so plugin files just move them to the path the error says xcode expects them to be in.
I have tried using Cordova 2.4 & 2.7 to no avail. The project seems to build fine when using the create method in console, except it does not create the whole program structure. The www folder is missing (or assets?).
When I open the project in Eclipse, I can see the assets folder on the left sidebar pane, but there is no children (it is empty).
The default app builds and runs fine (it just says "Hello World, App").
I should note that I tried this in cygwin also, and it came up with an error.
An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1
Deleting project...
I am using Windows 7 x64 with Eclipse 4.2.2, Cordova 2.7 (also tried 2.4). I have the ADT plugin installed on Eclipse, and here is a screenshot of my SDK manager.
I have the entries in my PATH variable set that I followed in the Getting Started tutorial.
If anyone has some input or ideas in how to resolve this, it would be greatly appreciated!
Hey If you are creating a project then you have to create a assets/www folder etc,You have to make changes in other files too.
Follow the link below you have all the information you need
http://www.adobe.com/devnet/html5/articles/getting-started-with-phonegap-in-eclipse-for-android.html
Be sure to change the cordova version etc,as per your requirement.