How to commit new version using SVN - android

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.

Related

Creating a new Android Project in Terminal-IDE

Is there a script or something that creates a new Android project in Terminal IDE on Android? How does the R file get updated with new resources?
This might help : http://developer.android.com/tools/projects/projects-cmdline.html
It will create a project that can be used...with ant.
Maven has an archetype system that can create a new Android project : https://github.com/akquinet/android-archetypes
There doesn't seem to be any gradle equivalent (yet).
You need to create your project's home folder and then create the
./src
./dist
./res
./build
./build/classes
directories and add an "AndroidManifest.xml" file manually.
It works. Copy the "builder.sh" script in the project's home folder and make the proper changes like cd into your project's home folder, set your project's package name and select the main activity class.
As per your question about the R.java file, the aapt tool from Android SDK detects the changes in resources and writes R.java file and packs resources accordingly.

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

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

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)

Cannot commit android "gen" folder to Git

I am using EGit in eclipse to provide Git support for an Android project I am working on. The problem is that after committing my project to the local repository I realized that the "gen" folder was not getting committed. As a result of this when I try to open the project on another machine after getting the latest source from the Git repository I keep getting the following error:
ERROR: Unable to open class file D:\CodeRep\POCs\Java\Android\Sudoku\gen\org\blah\example\R.java: No such file or directory
Why can't I commit the "gen" folder to Git from Eclipse ? Everything gets committed just fine so I can push it to the remote repository.
You shouldn't be commiting the gen folder; it contains generated code and doesn't belong in source control. You should be recreating it on the machine you pull the source code on with either an Eclipse "Project -> Clean" or a command line "ant clean" if you're using the build scripts.
This is a file of generated code, you would normally only be commit sources to git.
You probably need to clean your project when you check it out, perhaps you've got some other object files mistakenly included in the commit so it looks like it's already been built.
It shouldn't be necessary to commit the "gen" directory to git as everything in it should be automatically generated based upon content elsewhere in your source. In fact, the "gen" directory may have been added to your .gitignore by the Android SDK.

How do you share an Android project?

I am trying to send the files from an Android project so that a friend of mine can open a new Android project in eclipse and mess around with code/run the project from their home machine. However, I have run into some problems dealing with missing manifest files, and non-matching signatures.
What is the simplest procedure for bundling up an Android project (not an .apk) to send to someone for their use in eclipse?
The easiest way would be to create a Archive File export. It bundles the projects in your workspace into an exported .zip file. This .zip file can then be import by the other person into eclipse through the Existing Project importer.
To export:
File > Export > Archive File
To import:
File > Import > Existing Projects
into Workspace
Select the exported .zip file as
the Selected archive file
Put it on a source control server, like SVN. If you don't have one, you can use something like Google Code ( http://code.google.com ). Eclipse has built-in source control features to update and commit things to source control.

Categories

Resources