PhoneGap 3 and IDEs - android

I'm trying to grok the best practices workflow for PhoneGap 3, and was wondering how all this is supposed to tie together:
For generic functionality, the code that is developed is in the top-level www folder.
For phone-specific functionality, the code that is developed is under the platforms/platform/ directory.
BUT when using an IDE, the project files seem to be down in the /platforms directory (for example -- the .xcodeproj file for ios is in the /platforms/ios directory), and only includes the files under /platforms, not the top-level www directory.
My question / issue is this. We have a team that's used to working in IDEs like VS / Xcode. How do I set up a project that allows them to work on the top-level www files and emulate on the platform(s) they're focusing on?

The answer to this question appears to have come from the folks over at Adobe.
Brackets is a relatively new open source IDE that is directory structure-focued, along the same vein as Smultron or TextWrangler, for those who are familiar with OS X editors. Hopefully this removes the temptation to go playing around in the /platforms directory instead of editing files in the top-level /www directory.
It has a plugin architecture, with support for Git / GitHub and PhoneGap Build. So far it looks pretty promising.

Related

Connection with SQLLite on Unity3D using Javascript in Android

How can connect with SQLLite from Android using Unit3D and Javascript?
Someone can'i help me?
Here are the specific steps to getting SQLite set up in your project.
Download SQLite - you'll want the ZIP file with the DLL inside
that's in the Precompiled Binaries for Windows section.
Important Copy sqlite3.dll into your into your project's Plugins folder (make a folder called Plugins if you don't have one).
You won't get a warning if you don't do this, and your project will run fine in the editor, however, it will fail to work when you actually build your project, and will only provide information about this in the log file.
This will give you a License Error if you're using Unity Indie, but it doesn't seem to have an effect on the actual play in the editor, nor does it seem to effect the ability to build stand-alone versions.
Alternately, you can leave it out of your project entirely, but when you build your application, you'll need to include a copy of sqlite3.dll in the same directory as the .exe in order for it to work.
In your project, add in the dbAccess.js file: http://wiki.unity3d.com/index.php/SQLite#dbAccess.js
You should be good to go!
Source (and the above is pretty much copied word-for-word from):
http://wiki.unity3d.com/index.php/SQLite

How to force Android Studio to use relative paths?

Every project created in Android Studio 1.0.2 contains several files that reference the project's own absolute path. I can't even move my own project directory if I want to, let alone share the project with other developers.
Excluding files in app/build, these are the files containing absolute paths:
.idea/workspace.xml
.idea/modules.xml
.idea/libraries/support_v4_21_0_3.xml
.idea/libraries/appcompat_v7_21_0_3.xml
.idea/gradle.xml
.gradle/2.2.1/taskArtifacts/taskArtifacts.bin
.gradle/2.2.1/taskArtifacts/fileSnapshots.bin
app/app.iml
How do I force Android Studio to use relative paths for everything?
Edit: By experimenting with vanilla IDEA, I've narrowed down the origin of these absolute paths to a specific type of module, which Android Studio apparently always uses without offering you a choice. But I'm still no closer to understanding how to eradicate them.
In IDEA 14.0.2, if you create an empty project or an Android project with an "Application Module", the project does not contain any absolute paths. If you create a project with a "Gradle: Android Module", then it contains absolute paths in the same files as an Android Studio project.
Edit #2: Created IDEA-134587
In general, don't consider any of the .iml files or the contents of the .idea folder to be part of the project, and don't share any of those files, don't check them into source control, and don't move them with the project. Think of them as cache files.
The Gradle files are the source of truth, so if you're having troubles with absolute paths, close the project, delete the non-shareable files, and re-import it from the Gradle build scripts.
I ran into the exact same problem, but the solution suggested above contradicts JetBrains' advice as well as this answer. Also, my co-worker working from the same source code (with unexpanded paths) and Android Studio version wasn't having the problem, so I kept banging my head against the wall.
We eventually solved the problem when we realized that many of the paths I used included symlinks. In my case, I had a symlink set up for ~/work so that it pointed to /some/drive/with/space. Within Android Studio all of my source was referred to from ~/work/source rather than /some/drive/with/space/source. When I changed everything so that Android Studio referred to things with their actual paths, the $PROJECT_DIR$ and $MODULE_DIR$ variables magically started working and my .iml files were no longer getting corrupted. YMMV.
TL;DR: Don't use symlinks in your project paths!
Also, be sure to not keep the files within .gradle as part of your shared project.
Also, one set of files that you might want to share though are your files under .idea/copyright though as that allows you to have shared copyright settings.
So a possible .gitignore file might be:
.gradle
.idea
!.idea/copyright/[YourCopyrightFile].xml
!.idea/copyright/profile_settings.xml
*.iml
build
local.properties
Hmm. I just don't see the same absolute paths in those files, I only see references to MODULE_DIR and PROJECT_DIR, such as:
./app/app.iml: <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
or:
./.idea/workspace.xml: <entry file="file://$PROJECT_DIR$/.idea/libraries/appcompat_v7_21_0_2.xml">
I wonder if this is Linux issue only, or something in your settings?

Two git repositories sync between just a part of it

First of all, sorry if I ask a stupid question, I'm new to git world.
I have two PhoneGap projects: one is for iOS, the other is for Android. in project structure www folder is common:
Android (eclipse ADT):
../assets/www
iOS (xCode):
../www
So the question is: is it possible that on the remote server I have one repo for each project and when I push with Eclipse, the content of www is automatically written to iOS's repo and www object too?
Any hint is welcome.
There are lots of ways you could solve this:
Sticking strictly with Git, check out Git Submodules which allows exactly that.
Alternatively, if like many bigger Java-like projects, you're using dependency management, e.g. Maven / Ivy / Gradle, you could deploy an artefact (normally a JAR) of just the assets you're interested in (either from one of the projects or split the assets to a separate project), and have this as a dependency in both iOS and Android projects.
...or a really quick-and-dirty solution is to symlink one of the directories to the other, but this can get a bit crazy so be careful.

How to use the root phonegap www folder?

When you create a phonegap project you start off with a root www folder, among other files.
/www
You then need to add devices to work, for example andriod or IOS. This then creates a new www folder inside the respective playforms:
\platforms\android\assets\www
My question is, when using Android Studio how are you meant to use the root www folder? If at all? Which www folder am I meant to be building with?
It appears that when importing with Android Studio to go straight to the platform/andriod.
You should be editing the files in the /www/ file. When the CLI tools run prepare, which happens a lot, these files are copied into the appropriate platform's /www/ file. (This is because each platform can have it's web assets in a different location.) So do all of your work in the main /www/ folder - this is the one you should be putting into version control.
For more information try reading the documentation guide about The config.xml file which describes some of this: http://cordova.apache.org/docs/en/3.1.0/config_ref_index.md.html#The%20config.xml%20File
I've also written up a pretty long answer in another question that is pretty similar: Should a phonegap plugin be declared in the config.xml file?

Allow the same project to be opened and built with Android Studio OR IntelliJ IDEA

I develop an SDK, and would like to be able to check in module files for both IntelliJ IDEA and Android Studio. I've devised the following solution, with one missing piece:
Create module files ending in -intellij-idea for the main project, and each module.
Create build.gradle files, and use the "sourceset" directive to use the old style src and res directory structure.
The problem is that the project information is always stored in a directory called ".idea". Before, I could have two IPR files, such as my-project-android-studio.ipr and my-project-intellij-idea.ipr. I could then open one in Android Studio, and the other in Intellij IDEA, but the actual source would remain the same.
How can I accomplish this? If there is a way to force Android Studio to generate IPR files instead of the ridiculous .idea directory, that would be optimal.

Categories

Resources