First step in cordova - android

I started with cordova and I have some small problems.
I've created an android application. I have installed java, android SDK , Apache Ant and Apache Ant.
I have added android with cordova add platforms android and builded correctly.
1 - When I use cordova run android I get the following error:
an error occured while running the android project . Buildfile : ...Demo \ platforms \ android \ build.xml . ERROR : Failed to install apk to device
I think this is due to the fact that my application is not in debug mode. How to set the debug mode? (' cordova emulate android ' works and launches the emulator )
2 - When I want to load a project in eclipse . (New project - > Android Project from Existing Code) I have the error:
Invalid project description Reason : . Invalid project description
How to overcome this error ?
3 - I want to install external plugins, eg
- https://github.com/ClickInnovate/CordovaPhoneGapPlugins/tree/master/Android/SocialMessage
- https://github.com/phonegap/phonegap-plugins/tree/master/Android/StatusBarNotification
It is said that to copy the java files in the src folder , but, I copy the java files in the original project or one that is build ( in plateform directorie )

If you run cordova run android -d, you will see additional debugging information printed to the console which should hopefully help you narrow down the problem. I've never seen that error you are getting, but to set your device up for debugging you should follow these steps. Some steps may be different or unneeded based on your Android device and version:
Settings --> Click on "About Tablet" --> Click on Build Number 7 times to activate "Developer mode"
Settings --> Developer options --> USB Debugging (make sure it is checked)
Settings -->Security-->Unknown Sources` (make sure it is checked)
Storage --> Click the drop down on the top right --> USB computer connection --> Make sure "Camera (PTP)" is checked
Please ensure that you are following the Android platform guide. If you are getting "Invalid project description" you might just need to type in a project description in one of the boxes in Eclipse? Another thing, make sure you are doing Import-->Android-->Android Project from Existing Code. Finally, it sounds like this might be a goofy Eclipse environment issue, here is another question on SO about this problem.
The plugins that you listed are old, they were made before Cordova 3.X came out. In 3.X, a new plugin management system using Cordova CLI and Plugman is used to install plugins - the only problem is that the plugins need to be updated to use this new format. You could look around to see if somebody has updated those plugins (look on the Fork page on GitHub is one good way.) Otherwise if you can't find an updated plugin, you could try to update the plugin yourself following the upgrade guides on the doc website. To answer your question, the java files would be need to eventually be copied into the build folder. In 3.X, the files are stored in the /plugins/ folder, then copied to the /platforms/android/ folder when you run cordova prepare, and are built into the cordova.jar when you do cordova compile. You can also read about how to install plugins with just plugman.

Related

Unable to Build and Run Unity VR project for Daydream on phone and having hard time debugging the application

Although I’m able to run the apk on phone, but whenever I try to build and run my project directly from Unity on phone, it doesn’t work. This is the error message it shows:
On checking the console, these are the messages it shows:
But I'm pretty sure my path is correct, I checked it multiple times. Also, the APKs are building and working fine. Let me know how can I Build and Run from Unity as I'm not able to debug the applications.
This seems to be a known issue that is solved by downgrading the Android SDK tools to an older version as reported here.
I am just going to re-narrate the steps in the link I shared above for convenience as follows:
Go to Android Studio website.
Scroll down to the end of the page and download the command line tools from the section titled as "Get just the command line tools"
In your computer, go to $AndroidSDKHome$ and rename the tools folder to tools.bak
Extract the contents of zip file that you downloaded to the $AndroidSDKHome$. This basically will replace your SDK tools folder with a downgraded version.

`svn checkout` fails with the “cannot run program” “cannot find the file specified” error

I'm Checking a sample in google code. It requested me to checkout the source using SVN Checkout. Sine I am using Android Studio, I used the Subversion checkout options in VCS-->Checkout from version control-->Subversion. Howerver I encountered an error. Is their something I have done wrong?
Checking out google sourcecode.
Error = 2
As you can see in this, picture you can see the folders and of course the sources but how come it could not find it?
The error Cannot load supported formats: Cannot run program "svn": Create process error=2, The system cannot find the file specified indicates that Android Studio / IntelliJ IDEA can't locate Subversion 1.8 command-line client on your machine. Follow these steps to solve the issue:
Make sure that you use the latest version of Android Studio IDE.
Make sure that command-line svn.exe 1.8 client is installed on your system. You can get one at http://www.visualsvn.com/downloads/
Add the command-line client to %PATH% environment variable.
Restart Android Studio.
You may want to read the related blog post about the same issue with IntelliJ IDEA: http://blog.jetbrains.com/idea/2013/12/subversion-1-8-and-intellij-idea-13/
None of the answers here were working for me, though they were on the right track. This was the solution for me:
Download SVN command line tool from http://www.visualsvn.com/downloads/ as bahrep mentioned. Stick the binaries somewhere.
In IDEA: File > Settings > Version Control > Subversion > And then...
Make sure "Use command line client" is checked and select the path of your SVN.EXE.
By default, the path was simply set as svn. I had to change it to c:\wherever\i\put\it\svn.exe
I am not sure if accepted answers works. But Android Studio-> Settings->Subversion-> Uncheck "Use command-line client" worked for me!
I Have Android studio version 0.8.14
Here is What I have done
Go to settings-> (Preference in Mac)->subversion->
in general tab uncheck the three box :
User Command Line Client
Use system default blalbala
Update Administrative blabla
And go to Network Tab :
select SSL Protocol to : SSLv3
Hope it Works. mine working like a charm.
I've got Android Studio v1.4.1 and...
Check that the SVN plug in is present and activated. (/File/Settings, Subversion Integration should be in the list.
/ File/ Settings/ Version Control/ Subversion/ Uncheck use command line client
Test communicating with the repository via / VCS / Browse VCS Repository / Browse Subversion Repository. The SVN Repositories window should appear and you can add your repository there and see what is inside that repository.
By default Use command line client is checked but you can change that with / File / Other Settings / Default Settings / etc. etc.
An easier way for fixing this error, if you are on a Windows platform would be installing SVN directly from this download source http://sourceforge.net/projects/win32svn/
This runs an installer that automatically creates directories, and registers SVN routes for future command line use.
Follow easy steps:
Download Apache Subversion command line tools from below url
https://www.visualsvn.com/downloads/
extract the folder and save to some location and copy the path of folder
now in android studio
Android Studio-> File->Other Settings->Default Setting->version control
now here
only check use command line client and paste the above folder path.
now you can give path of sub version.
I had to disable interactive mode by clicking on checkbox in front of "Enable Interactive Mode" under File=>Settings=>Version Control=>Subversion apart from setting "Path to Subversive executable" as suggested in other post.

Phonegap How to make android build

I have created a build in ios successfully. Now i am trying to make build in android.
I have added android platform and imported this in eclise(ADT). I want to make configuration for android, as i am new to mobile application. I am unable to find any good reference for building android tutorial. I looked into getting started tutorial of phonegap but it was not much helpful
I assume you're using Cordova 3.0 and CLI
Proceed as following (some steps you might have already done, for completeness, I list them here anyway)
Open Eclipse ADT -> Window -> Android SDK Manager and make sure you have at least the 'Android SDK Tools', 'Android SDK Platform-tools' and at least on API installed.
Add the 'android sdk tools' and 'android sdk platform-tools' to your path.
In your cordova app (e.g. /myApp) folder, execute $cordova platform add android
Im assuming you have all your jscode correctly bundled in the /myApp/www folder, as you already have a working ios build. Otherwise, do so.
Plug in your Android Device or create and start a new AVD (In Eclipse: Window -> 'Android Virtual device manager').
execute $cordova prepare android
Open Eclipse and then File -> Import -> Android/Existing Code Into Workspace. In the opening 'Import Projects'-Window, select your /myApp/platforms/android as root directory. Depending on your workspace, you must select 'Copy projects into workspace', however your workspace would better already include the project, as this saves you from importing a new project after every $cordova prepare statement
In Eclipse: Run -> Run Configurations -> Target:: Enter Your settings depending on wether you use AVD or not.
On the bottom right: Run. Your app will be built and run.
Notes:
If you use mulitple platforms (e.g. android and ios), this way is more preferable than the way of user1306579, where you copy/hardlink your code directly in the /myApp/platforms/android/ folder, as you would have to do this for every platfrom equally and even worse: If you run $cordova prepare (or any command containg this, as $cordova run, $cordova build, ...) you would loose your changes.
Never edit JavaScript-Code directly in your /myApp/platforms/(anyplatform)/www/ folder. Always use /myApp/www/ and run $cordova prepare afterwards...
After step 5 you could use $cordova emulate android (for your avd) or cordova run android (real device), which would replace all other steps. However, if there are errors coming up, finding the reasons might be more difficult.
If your questions was over how to configurate the android app (platform merges, manifest configurations, ...) feel free to ask again :)
Regards, miweiss
I builded phonegap application with ant.
I think that this is not a big deal to build it with eclipse. You should copy web resources to the platforms/android/assets/www folder. Then you should use platforms/android as your project folder. I think you can use symbolic or hard links instead of copying to always refer to actual data.

Deploying Phonegap / Cordova app for Android?

I've got a Phonegap/Cordova 3.0 app that I am testing on Android.
Since version 2.x, Cordova relies heavily on the command-line terminal. I've done all the setup stuff and I can build the app. But two things are troubling me.
First of all, an Android project has two www folders. One is [myproject]/www. The other is [myproject]/platforms/android/assets/www. I'm not sure which of these folders to edit when I am fixing bugs.
If I am correct, the first one is where you place your app files before using the command-line "cordova build" to create the app. The second one should then be only a copy that's used after building, before deploying.
Now my question is, when I make a change to my app and I want to test on device, do I have to use the command line to (re)build the app every time?
[myproject]/www is the directory in which you should put your source files. When you build your app these files are copied in to [myproject]/platforms/[platform]/assets/www. In addition to this, files in [myproject]/platforms/[platform] are also copied to [myproject]/platforms/[platform]/assets/www, which allows you to create per-platform overrides to your files.
Note that you should never edit files in [myproject]/platforms/[platform]/assets/www directly, as they will be deleted next time you build your project.
To run your project on your device use cordova run [platform], or to run it on an emulator use cordova emulate [platform].
I found a solution: in command-line terminal, type cordova run android and the app will be built, deployed and run on device.
Hi First thing : Edit www folder inside the asset folder.
Second : no need of command line build , you can take build via eclipse its very easy, Right click on project root folder --> Run As -> Android Application

debugging android tools code under windows.

There is a crash bug in the aapt tool that happens till R12 (checked).
i'll give more details later, but for my question:
The bug happens on windows system, not on linux, it's not related to eclipse, i tried from the command line as well.
I want to debug the appt process under windows, will adding -g to the building fags in the android build tree (i'm using the trunk) solve the problem ? i want to see where the crash is and see if i can fix it but assembly code wont help me much and it doesn't reproduce on linux machines so i can't debug it in it's natural env.
(the tools are compiled for windows under linux using mingw32 library for linux, using sdk product with '_sdk_win' ).
Regardig the bug itself:
open an Android project under eclipse and call it 'a'
open the 'a' properties and check the 'Is Library' check box.
open another Android project and name it 'b'.
open it's properties and add 'a' as an android library it uses.
open the android plugin preferences and change the build from silent to verbose
clean both projects.
on linux everything is neat, on windows it crashes after the line:'baseFile zd has flavor (null)' which according to linux should be:'baseFile 0 has flavor ,,,,,,,,,,,hdpi,,,,,,,'
most chances null pointer exception occurs here, the question is why only on windows ?
The bug is gone from the next version (compiled from the trunk).

Categories

Resources