Eclipse: svn:externals in cross-platform Phonegap folder structure? - android

In Eclipse (on Windows) I created a cross-platform folder structure for Phonegap :
--phonegap_android
--assets
--www (symlink/junction to 'src')
...
--phonegap_ios
...
--src
index.html
Here's what I did to get this working :
created an Android-project in Eclipse based on the phonegap-android
folder.
made a junction for the 'assets/www' folder to link with 'src' (using the Sysinternals command)
created a svn-repository, for this entire project (the parent project that has the different folders for android, ios and src).
I can run the application now, but I have problems committing the project to svn.
The 'www' folder is a junction-folder, so when changes are made to this folder, I want this folder to commit to the real source folder : 'src'.
I tried different approaches :
Setting an svn:ignore on 'assets' to ignore 'www', but then of course
nothing in www is committed, when I commit the android-project in Eclipse.
Setting an svn:externals on 'assets' to define 'www' as an
external to svn://myproject/src, but then it still tries to commit everything in assets/www and I get an error 'No versioned parent directories'.
Any ideas how to get the www folder NOT committed, but at the same time get the src folder to get committed to the svn repository?

Dylan,
Following with svn:externals will work.
Create Folder 'phonegap_android'
Under 'phonegap_android' create folder 'assets'
Commit them to svn repository 'svn://myproject/phonegap_android'
Now for the 'phonegap_android' folder, set the svn:externals as follow
'../src assets/www'(if your svn path for src is at same level as phonegap-android svn://myproject/src which is in your case)
On windows using tortoise svn, it will let you commit 'phonegap_android' folder with svn:external changes.
Take svn updates and you are done.
Henceforth whatever you commit to phonegap_android/asset/www folder, it will be committed to src folder(svn://myproject/src)

Related

Put Android Studio application in sub-folder in Git

I have repository in Git that has this structure:
-web-app
-mobile-app
When I checkout the project in Android Studio my project has structure like this:
android-studio-project
-web-app
-mobile-app
The mobile-app folder is folder that contains the module of my android application end when I commit some changes some files and folders like gradle/wrapper, build.gradle, gradle.properties, settings.gradle are outside the folder mobile-app and my Git structure goes like this:
android-studio-project
-web-app
-mobile-app
-gradle/wrapper
-build.gradle
-gradle.properties
-settings.gradle
-...
I want to put all files and mobile-app folder in sub-folder in order to achieve first Git structure.
I tried to create a folder in Android Studio and move all needed files there but the project totally messed up.
I moved the gradle's files in to mobile-app folder but could not build the project at all.
Any ideas how can achieve the desired Git structure?

Is there a way to clone an IntelliJ IDEA gradle project?

I'm trying to move my IntelliJ IDEA (2017.3) Android project to another computer just copying the files and it does not work. I am aware of this and this, but in the case of Android project it does not work. All the xml files inside .idea store paths relative to the home ($USER_HOME$) instead of project home ($PROJECT_DIR$). Oddly, Maven projects seem to generate paths relative to the project home and those ones can be copied. But not with gradle projects.
Anyone knows how to solve this ?
EDIT: Bear in mind that I want to copy ALL project settings included running configurations. I want that someone opens the project and find exactly what I have. I know I can reimport the project, but then I'll loose some configuration.
Here's the files and folders that need to be excluded from the copy (assuming that your project has a module called app), preferably if you copy the entire project folder to some where else on the same computer and then deleting the unneeded one by one:
folders .idea, .gradle or any folder who's name starts with a .. They are usually found within the root folder of the project and within the module root folder.
build folder found in the project root folder and in module root folder.
any file who's extension is .iml, found in the project root folder and in module root folder.
local.properties found in project root folder.
The rest of the files and folders need to be kept. With the above excluded, the project can be re-imported in Android Studio properly with the correct configurations relative to your second PC.
On a side note, these are the typical exclusions added in .gitignore of an Android Project Git Repo.
Ok, I found the problem. It is related to how gradle resolve symlinks. This is the issue. Summarizing, if you open your project with a path that contains a symlink, absolute paths will be created in the configuration files and your project won't be portable.
I have reopened the project again using an absolute path and then all the configuration files use PROJECT_DIR instead of USER_HOME

Android - How do I create the assets folder manually?

I'm new to Android development, and I'm trying to manage projects from the command line using the SDK since I cannot get Android Studio 1.2 to work properly in my system (it's unresponsive).
The problem: I created a new project but the asset folder is missing.
Other SO answers (enter link description here) solve this by creating the folder from the IDE, or by pointing to the asset folder in the .iml file, with doesn't work in my case (I trying to mange the projects from the command line entirely)
There's also a solution editing build.gradle, but the project created from command line (using the SDK) doesn't seem to be a gradle project.
Any help would be appreciated.
Just create a directory called "assets" at the root of your project, i.e. in the same directory your AndroidManifest.xml lives. There's no need to "link that folder from the project". At least that's the case on my system, where I'm using Android SDK 24.4.1 (and I'm not using Gradle -- just emacs and ant).
Once I had assets/fonts/aisauc.ttf in there, the following code...
import android.graphics.Typeface;
...
Typeface greek =
Typeface.createFromAsset(getAssets(), "fonts/aisauc.ttf");
mytextfield.setTypeface(greek);
gave me a TextField with characters from the font I wanted.
How do I create the assets folder manually?
You make it the same you make any directory on your filesystem. Whether you use mkdir or a command-line equivalent, or whether you use your desktop OS's file manager, is up to you.
The default location for an assets/ directory is in a sourceset (e.g., src/main/assets/, to go along with src/main/AndroidManifest.xml and src/main/res/ and src/main/java/, where src/main/ is a sourceset). You can have an assets/ directory located elsewhere, if you choose, but then you will need to configure your build.gradle file to teach Gradle the alternative assets/ location for whatever sourceset you are trying to apply it to.
In your left most sidebar or the sidebar that shows the app, manifests, java... etc, right click app > New > Folder (has the green android symbol next to it) > Assets Folder.
On the next screen leave the path as 'main' and click 'Finish'. Then you can drop whatever asset you want into the folder.

How to commit new version using SVN

Problem (updated)
1. How can I replace the old version source code with new version?
I used TortoiseSVN to create a svn folder called svn://svn.domainname/program/android and uploaded these source code:
source code of an Android project
source code of a supporting library
The local path (in my Mac) of the uploaded files is:
~/svn_android/,
and the local path (in my Mac) of my Eclipse workspace is:
~/dev/android/workspace/.
After making some changes to my project in ~/dev/android/workspace/, I want to commit the new version to svn, but it doesn't work by just deleting all files in ~/svn_android/ and copying new version code from ~/dev/android/workspace/ to ~/svn_android/ and committing them.
Updated:
There are many newly created files and many modified files, so I don't know what can I do except deleting all of them (except the ~/svn_android/.svn folder) and copy-and-pasting into the folder with all of the current version source code.
2. Should I upload the metadata of Eclipse IDE?
Eclipse is used as IDE for the project. Not sure whether the metadata used in Eclipse has been uploaded in this process. The metadata folder/file is listed here:
~/dev/android/workspace/.metadata (folder)
~/dev/android/workspace/.DS_Store (folder)
~/dev/android/workspace/myproject/.metadata (folder)
~/dev/android/workspace/myproject/.settings (folder)
~/dev/android/workspace/myproject/.classpath (file)
~/dev/android/workspace/myproject/.DS_Store (file)
~/dev/android/workspace/myproject/.gitignore (file)
~/dev/android/workspace/myproject/.project (file)
Solution to the problem:
You should not be deleting everything in ~/svn_android/ folder. I don't know about OSX, but in Linux and Windows, there usually will be SVN meta data folder at ~/svn_android/.svn/. So, keep the .svn and delete other files/folders, then copy your working files from ~/dev/android/workspace/ and commit. As for the new files, you have to first add them: TortoiseSVN GUI > Add.
What I personally would do:
I would keep both local copy of SVN repository and Eclipse project at the same place so that there will be no need for copy/pasting. That's, in Eclipse
New Project > Android Project from Existing Code > Root Directory: ~/svn_android/
At this point, leave "Copy projects into workspace" unchecked.

Mercurial creating extra files after cloning a repo

I am working on an Android App and the APK file is located in the out folder. I am also using Mercurial as version control system and cloned the repo, the clone was successful but Mercurial created two APK files one inside the bin directory and another in the root directory of the project.
Why Mercurial created these extra two APK files and how to get rid of them?
You have these two files in repo, clone just show it to you
You didn't see only these files in original Working Copy, because (not discovered yet) local settings for original workspace now ignore these files (after they was commited to repo - see hg log FILENAME), but adding to ignore-list doesn't mean "automatically forget and remove from repo"
how to get rid of them?
In cloned repo-root create .hgignore, add global pattern for all and any (?) *.apk-file
hg forget both APK (or Forget from CMenu of THG)
commit changes
remove files from WorkingCopy

Categories

Resources