Build problems with ActionBarSherlock 4.2 - android

I have an Android project I'm developing using ABS 4.2 - the development box is running Mint 12 32bit with jdk 1.7.0_03 installed, using Eclipse Indigo.
I recently updated my laptop and installed Mint 13 64bit, jdk 1.7.0_07 and Eclipse Juno.
I pulled the workspace across from the desktop (via SVN) and have wasted about two days trying to build ABS (not even my own project yet!) to no avail. I keep getting a heap of errors (always 85), starting with a load of...
Cannot cast from Activity to SherlockFragmentActivity SherlockDialogFragment.java /library/src/com/actionbarsherlock/app line 27 Java Problem
I've checked the java and javac settings on both boxes - they both resolve to the Oracle installed software.
I've checked the project properties, both machines target 4.0.3 API 15 and the compiler compliance levels are both 1.6 - I'm really at a loss what else could be wrong, it all works fine on the desktop, just not on the laptop.
Could anyone please suggest what else I can try to resolve this? I really have run out of ideas.

Well, it would appear that SVN doesn't carry everything across from one machine to the other, though I still have to identify what wasn't (and include it so I have a full valid code base in SVN!).
I tried Indigo and it made no difference, exactly the same result, I also double-checked the libraries and they all seemed good. So I then decided to copy across everything I could, direct from one machine to the other, rather than using SVN (though didn't copy the sdks). Lo and behold... it worked!
I've preserved all the previous directories that I've now copied so will run a diff and see if I can identify what is different in either the workspace or elsewhere. I'll let you know if I manage to identify the culprit.
Many thanks for both your suggestions, between them they were enough to redirect my thoughts to a slightly different approach, which paid off.
Convivial Latest Arbitrary Chronometric Measurement Period to you both.

Related

Eclipse/Android can't generate R files for any project

I am a new Android developer (4 weeks into porting my iPhone app to Android). I have 8 projects (the app, and 6 small UI experiments, and a vanilla Hello World project that I just created with Eclipse). All fail to compile, and the issue is that every reference to the generated file R is flagged as "R cannot be resolved to a variable".
Up until yesterday afternoon -- every project compiled and ran (albeit very slowly) in the Android emulator. I've changed something, and since yesterday, all projects fail to compile, all in the exact same manner "R cannot be resolved to a variable". I every case, the generated files are missing. I believe they disappeared as I tried to clean and rebuild each project in the course of debugging this problem.
Two things that I know changed when this problem started, but that I can't say caused the problem, were: 1) shifting to debugging on a real Android device (a Samsung Galaxy Tab 2, which worked like a champ after struggling with the slow emulators), and 2) allowing Android (and perhaps Eclipse) to update themselves from the web.
I've spent many hours trying other user's suggestions and none have helped. Most suggestions refer to file naming issues, xml syntax errors, but I haven't changed these files and filenames since compilation was working. I have tried:
cleaning and rebuilding the projects
checking for subsequent updates to the Android SDK (and there were 2 subsequent ones)
Eclipse->File->Android Tools->Fix Project Properties
making small source changes to force rebuilding
rebooting Eclipse, as well as the Mac host, adb, the emulator, the Android SDK Manager
deleting a project, restarting Eclipse, and adding the project back in (bad idea - this fails with an error "Failed to load properties file for project 'ListViewFragmentTest'"
creating a brand new Android App project, which has worked many times before, but now fails
There's something going systematically wrong, and while I won't claim all these projects are bug-free, they did run up until 6pm yesterday, and then all stopped compiling thereafter.
I wonder if anyone has other suggestions, before I embarking with a complete reinstall of the development environment?
My environment is:
Macbook Pro (OS X 10.7.5, 8GB RAM, 2.53GHx Core i5)
Eclipse (Indigo Service Release 2, Build: 20120216-1857) (too old?)
Android SDK Manager Rev 22
Android SDK Tools (22), Platform Tools (17), Build Tools (17)
API's 11-17, all up-to-date
Seems like lots of people experience trouble with missing generated files (R), and I have had trouble when I've had layout XML errors as well, but that doesn't seem to be causing this problem. Thanks in advance for your help!
I am not sure but you are facing issue of R.java file is not getting generated after updated with ADT rev 22.
If this is the case then here is the solution:
Hope you know Android studio has gradle building tool. Same as in eclipse they have given new component in the Tools folder called Android SDK Build-tools that needs to be installed. Open the Android SDK Manager, select the newly added build tools, install it, restart the SDK Manager after the update.
Check in the Java build path library, whether "src" check box is checked or not.
If you are using any additional Libraries then make sure libs/android-support-v4.jar is same for project as well as the Libraries.
Thanks everyone. None of these suggestions resolved my problem. And while I'm curious as to why it happened, I was more impatient with not making any progress. I've reloaded Eclipse and the Android tools (this time with the bundled version from developer.android.com), and everything is working smoothly again.

Why is my updated Eclipse / Android setup not building my APK anymore?

I had a working Eclipse setup with 3.6.2 and SDK tools from version 11, and it has been building my main project just fine for quite a while.
For a different project, I thought I needed to upgrade my SDK to the latest and greatest - at this point API 14 (ICS 4.0).
I cannot even reconstruct the steps I went through, but what happened was that my project would seem to build, but I would see that it would say that it was skipping a post-compiler step, and at the end I would have no APK.
I also noticed that it updated my .classpath so that the output path was bin/classes instead of .bin.
Along the way I tried updating my Eclipse to the latest version (Indigo 3.7.1) but this didn't help.
I solved the problem eventually with help from this post on the Google Android forum:
http://code.google.com/p/android/issues/detail?id=21031
For me personally the biggest issue seemed to be solved as follows (qutoe from comment 25 in the forum post)
"I seem to solve the problem with .apk files not being built automatically until run/debug is used (comments #10, #11 etc.). Go to Windows -> Preferences -> Android -> Build and uncheck "Skip packaging and dexing until export or launch" then restart Eclipse. Works for me."
But there is other useful material there. Different people with different projects seem to have different problems with this setup.
I still don't understand the change in the classpath, but it doesn't seem to matter.
In addition, I found a discussion of installing the ADT with Eclipse Indigo which was helpful here in Stackoverflow:
Eclipse Indigo - Cannot install Android ADT Plugin
I also found that I guess because of various uninstalls/reinstalls, for some reason it stopped excluding my .svn directories from the sources. This Stackoverflow post was helpful with that:
Why is eclipse trying to copy my .svn folders from src to bin, and how can I make it stop?
Finally: a tip for really and truly uninstalling Eclipse - everybody says there is no uninstall, and there isn't, but there is a directory that Eclipse leaves in your home directory (in windows 7 under c:\users\) called .eclipse -
Zap it if you really want to start fresh.
In addition, for less extreme measures, there is Project->Clean inside Eclipse, and you can invoke eclipse with "eclipse -clean" for additional cleansing effects. No idea what, but various helpful people along the way suggested trying that to solve problems.
Ah yes - when I first installed Indigo and tried to build, I got a warning that my Java Compiler Compliance level was not up to snuff, which was simply not true - I have only Java 1.6 installed on my machine.
See this post for somebody who had similar experience:
http://marakana.com/forums/android/general/374.html
For me, what worked was simply going to Project, Properties, Java Compiler, then click on Configure Workspace Settings, and click on Ok in the dialog. Didn't need to actually change anything. Just showed it that everything was ok!
Eventually I indeed did clean out my Eclipse and Android installations (including the aforementioned .eclipse directory, and there's also an .android directory in your home directory which you may want to erase if uninstalling the Android SDK Tools doesn't do that - this actually is uninstallable). Installed everything from scratch and then used the additional information provided above and now it's building my APK.
I hope this saves somebody the hours I spent getting my build back in shape.

Motodev / Eclipse freezes up for several seconds when autofill tooltip proprosal pops up

I recently installed a fresh copy of Motodev. When I type the name of object and a period after it a popup comes up with a list of all of the methods available to that object. Ever since I started using this new copy of Motodev if I have an object with a very large amount of available methods this process freezes the whole program for several seconds.
RelativeLayout and EditText are the two that I have personally noticed that this is a problem with, but I suspect any object that has a large number of methods will cause this. It was never a problem before. Has anyone else seen this issue and if so how did you fix it? I do like having the list pop up so that I can see all of the methods available to me so I'd like to leave that feature turned on if at all possible.
Looks like you figured this out already, but I'll say it for future readers. There is an update to MOTODEV Studio specifically to work with ADT 8.0.1. There were some API changes in ADT that required us to update Studio also. ADT 8.0.1 requires Studio 2.0.1, which is based on Eclipse Helios. There are installers on the MOTODEV site as well as an updater for Eclipse.
Because of the complexity of dependencies with all the Eclipse plugins, I suggest to download the .zip archive at MOTODEV rather than using the "Install Updates" method. I find that I get timeouts quite often at home on broadband that don't happen at work with a bigger pipe.
Also, Studio 2.1 will be available some time within the next week (~Jan 25) and will work with the 2.3 SDK and ADT 8.0.1.
UPDATE: 2/14/11 - It would appear that the correct answer is found at comment #8 in this link: http://code.google.com/p/android/issues/detail?id=7850
Tim will need to formally accept this answer at some point...
Which is as follows:
For those of you with this problem, here's what you can do until the fix is publicly available:
1. Download https://android.googlesource.com/platform/frameworks/base/+archive/<branch>.tar.gz where is one of those listed here (froyo-release for 2.2, the file is about 113MB): https://android.googlesource.com/platform/frameworks/base/+refs
2. Extract the contents of base/ in the tar into "/platforms/android-/sources" where is 8 for froyo, 7 for eclair, etc.
3. Enjoy fast content assist in 3.6!
If you are using eclipse v3.6 (Helios) this is a known issue with ADT - the android dev site recommends using v3.5 or v3.4 of eclipse until the problem is resolved.
EDIT: It might be dependent on the version of ADT you are using - I can't find the recommendation to use v3.4 or v3.5 anymore. Perhaps things were fixed with ADT 8.0.x Check which versions you are using anyway.

Setting up Android Development Environment on Windows 7

I want to start learning Android developement. I have a windows 7 Home Premium Operating System. My problem is I am not able to setup the environment of developing android. Here is what I have done till now.
I have installed Java (both 32 bit and 64 bit versions)
I have installed Android SDK (installer_r08-windows.exe)
I have not yet downloaded any tools or platforms or ADT.
I have downloaded 32 bit eclipse. (eclipse-SDK-3.5.1-win32.zip)
I am stuck at this eclipse setup. A strange thing I observed is that, it does not install. When I click on eclipse.exe, it starts running from there only. I am still not sure if my eclipse installation is proper?
So, I assumed that my eclipse is working fine. Then when I try installing new programs in eclipse, eg google plugin, it gives error.
I want to know, where am I going wrong? What mistakes am I doing?
Can anyone guide me with the complete step by step procedure to setup my android development environment on windows 7?
Thanks in advance.
Jay
to 5: Eclipse don't have a normal installer, its just a zip file you can extract and run from anywhere.
to 6: What errors do you get? (I will update my answer when you deliver more details)
A step by step how to is here: http://developer.android.com/sdk/installing.html
I found I had to relax Windows 7's security settings quite a lot just until Eclipse was fully set up, and then I was able to restore them back to their normal setting.
I want to share my experience of installing environment in windows 7 ultimate.
* I have faced problem with both the version of JAVA 32 bit and 64 bit (I may be wrong). After deleting 32 bit my problem was solved at first time.
* Maximum learner mistake to ensure properly their android environment variables.
So, hope you will ensure that above two problem.
Here I have attached a link where proper installing method has been given with image marking. So, I hope it will help you to setup environment properly.
http://sanathnandasiri.blogspot.com/2011/03/how-to-setup-android-development.html
Thanks for your important time.

Android SDK plug-in appears to impact Eclipse heavily

Am I the only Eclipse developer whose workbench quickly sputters, wheezes, crashes or hangs and makes me use Windows 7 Task Manager to hard-bounce it?
I've got dedicated, Android-only (as it were) installations of Eclipse Helios (3.6) and Galileo (3.5) with the very latest Android SDK (0.9.7.v201005071157-36220) using android-sdk_r06-windows.zip. I'm running Windows 7 Professional 64-bit, but 32-bit Eclipse (Helios and Galileo) and a 32-bit jdk1.6.0_20.
It is true that these are both Eclipse Java EE installations and not the bare-bones Java-only (non-WTP) versions. I haven't tried that yet. I followed a tutorial that said to use Helios, but said nothing about what not to include (like WTP which I ordinarily use in my work).
I can avoid much of the trouble by editing XML files using the standard Eclipse XML Editor and avoiding the Android SDK's various XML editors, but very quickly, things stop working and the whole thing caves in on itself.
I've tried bumping memory in eclipse.ini, -Xms128m, but that hasn't helped.
I'm looking to hear from someone who's gotten over this mess or who knows what I should have done.
Any ideas?
Thanks in advance for any and all comments.
Russ Bateman
After a week of frustration I reached the conclusion that you cannot install Android for use in Eclipse Java EE, my usual mode. Instead, use the plain Java Eclipse. My definitive installation became Eclipse Galileo SR2 IDE for Java Developers. I added these lines to eclipse.ini, though I probably did not have to be so generous:
-vmargs
-Xms256m
-Xmx1024m
-XX:PermSize=128m
-XX:MaxPermSize=512m
In order to distinguish this version of Eclipse from my usual Java EE development version on my task bar, I found an icon to graft onto it at http://www.large-icons.com/stock-icons/free-large-android-icons.htm and selected one that looked most like the green Android icon.
Add this line -XX:MaxPermSize=256m to your eclipse.ini file right after -vmargs. I have no idea why, but apparently it's a known bug. I can get you the source where I found this solution if you'd like, it took me a fair bit of googling

Categories

Resources