Strange error in Eclipse for android - android

I faced a strange error while working on android in Eclipse.The situation is like follows.I have a fully working project.While working on a activity java file, unfortunately my system shut down.When I reopen the eclipse after opening the system, some of the java files of my project converted to ASCII characters.I dont have a back up also.Please help me.The resulting java file look like the following,

Right click on your project -> Properties -> Resource -> Text file encoding and then choose your encoding (UTF-8, etc.)
EDIT :
Another approach could be Window -> Preferences -> General -> Workspace and then choose your encoding here

Finally I found the solution to the above problem.Eclipse always saves the file in a local history based on the modified date and time.To retrieve the recently modified file from the local history, follow the steps,
1.Open the corrupted file with eclipse editor.
2.right click -> Team -> Show Local History“
View the result in ‘History View’
and based on the modified time open the file with a text editor and copy your original content.
Another way
Eclipse workspace-->.metadata-->.plugins-->org.eclipse.core.resources-->.history
you can find a list of folders named with few letters, use the “Date Modified” column and open the latest of those folders to get the recent files you were working on.In that folder, you can find some files with unusual naming, open the files with some text editor to find the file you are searching for, if possible try to match the file size.

Related

Error on Add file to deploy in Android, with firemonkey delphi Xe7

Which file I manage the deploy Itemns to remove/add manually my database? When I click add file on tool bar (Second button), and select the sqlite file on explorer, I receive an exception below.
It was working very well, and I changed many times the database version before.
But now, I delete the sqlite file and can't submit the file again.
I hope to delete some file on explorer to reset the deploy list. Somebody can help-me?
ps: I restarted delphi and also the windows.
I found the file ProjectName.deployproj. The file has a xml structure with all icons, database and ini specification. I change the file manually but didn't fence the error. I got that the error just occur when I add a filename found in xml. But when I click delete on deploy windows, It don't removes the file. Like has another reference I can not change manually. Some idea? Thanks in advance.

How to Register New File Type Association with MP3

I am beginner with Android Studio. I have an MP3 file in my res\raw folder. When I sync project with Gradle files. I get the following dialog box:
How do I allow for MP3 files in my project?
I read this: Register new file type in Android, but I'm not building an MP3 player. My intention is for the user to have an MP3 player currently installed on their device.
I also tried navigating to File -> Settings -> Plugins and searching for an MP3 player for Android Studio.
Should I just select Text files and move on?
I do not need Android Studio to play MP3 files.
That window is just how you want Android studio to open the file so you can visualize/listen to the file. It does not affect how the file is handled by android at all.
Since Android Studio does not have a media player, I suggest you to select Open matching files in associated application
That will launch your default music player and play that mp3.
Note: remember that all the files under res should ONLY contain lowercase letters, numbers and underscores. If you have your mp3 with the wrong name conditions will not compile.
I decided to select Text files. This was a bad idea since opening the file results in encoded garbage output to the screen.
With help from this page. I went back to File -> Settings -> File Types -> Text files and removed *.mp3 from the Registered Patterns by clicking the red minus sign.
See this image:
After this I clicked OK and re-synced the project with gradle. When this screen popped up again. I selected Open matching files in associated application. Now I do not get this pop-up and the mp3 opens in Windows Media Player if I double-click it.
Select File -> Settings -> File Types -> Files Opened In Associated Applications
Click on the + sign
Add "*.mp3"
(If you have previously incorrectly associated "*.mp3" with something else, then Android Studio warns you and allows you to delete the old association)
Click OK
It does not matter how you want to use MP3 files in your project afterwards. Android Studio now knows how to open them in case you click on them.
This may not be an answer, but hope it'd be helpful to know that on Linux Mint Rebecca (based on Ubuntu 14.04), the problem is not reproduced.
Kindly check the naming convention used for the file.It should be all lower case in the res folder. This will solve the problem.
If not select on "Open matching files in associated application".
This is a common error. Check whether your file is named in lower case --this is very important.
Save file in text file format as showing in android Studio. Eventhough the icon is in text file in the raw folder, U will be able to hear the music on emulator or plugged in device.
Firstly check mp3 or mp4 file name. If you choosed Upper case letter for this video, you need to refactor it's name.
all the files under res/raw should only contain lowercase letters, numbers and underscores.
I changed the ".mp3" to "m4a" of the music and it worked

Is there a way to add such folder in Android project that do no get compiled up to **apk**

I was looking for a way to add some such folder in my Android Project that do no get compiled up to my apk file.
Why I need it :-
We need to maintain proper documentation for project (that actually
everybody needs to ;) nothing new),
but I find it very irritating to look out for that documentation
folder again and again.
.
I am open for any way i can make dcocumentain folder easily one
click accessible (I am already doing it thru taskbar sortcut. ) But
I want it to get the ease of version control thru Eclipse likewise we
do it for our project
IDE :- Eclipse
I got a way myself :-
I had an idea that if I create a folder in my application project with
some anonymous name that actually android has not listed in its
directories ("I am talking about the default one like "res", "src",
"anim"......)
Then either it should "raise an error" or should "ignore" it while compiling to form apk file
luckily it ignores any such folder. now i can put all the documentation in my project.
NOTE:-
My answer empirically driven
I had tested it by creating a "Docs" folder and then copied 1 GB of
random data (includes almost all type of files we came across from
multimedia to zipped ones).
Then I build the apk and the size of the apk was in-effective of all
this..
but when i copied the same data to assets it was showing a huge change
in size of my apk file..
Consider using Javadoc in addition or, if possible, instead of any other documentation.

Update a text file in the raw folder

I have an application reading a text file that is in the res/raw folder. It works great, but when I change this text file and try to run again the application on Eclipse (I don't need to change the raw file from this application, this I have seen that it is impossible. I just want to do it from Eclipse as I am still in the building phase of my application) and test it on my phony, the text file doesn't take into account the modifications.
The only way I found to update the file in the application is to uninstall it and re-run it.
Is it normal? Is there no way to do that?
As far as i understood, eclipse did not know it was updated, so
Right click on a project -> refresh.
If that does not help try
Project -> Clean
Yes it is a default behavior.
Assuming you dragged a file named "ABC.txt" from D drive inside the raw folder of your project. Project worspace is in E drive.
Once you drag and drop, a new file will be created in E drive inside your application folder. This file is different from the one in D drive.
Problem fixed, it was happening in the Searchable Dictionary (sample application from Android), the fix is simply to increment the database version when it's changed, and it will automatically load it again.

Finding out where a file in the project explorer is used in the code in Eclipse IDE

I am developing android applications using Eclipse IDE.
Now, I have given someone else's code to modify.
I need to check where a particular drawable/image in the res/drawable folder is used in the code or in the xml (res/layout). Also I need to find where I a particular xml (res/layout file) is used in the code.
Is there any short-cut to find out these things or I need to go through each & every line of code to find out these things ?
Please help.
#Ankit
For First Thing for checking a particular drawable/image in the res/drawable folder if you want to find that whether image resource is used in project or not for that you have to search like this in Eclipse For Example Your image name is bg.png so you can search like this using Ctrl+h in your Project Explorer than when search window Open you will find one File Search tab than write this in search box #drawable/bg than you will get Match Result.
For Second Thing Now use Same Ctrl+h than write this R.layout.yourlayoutname in search box than if this layout is used in your android project than you will get result for that.

Categories

Resources