You need to have lived in the United States for over half of the year in order to claim the Earned Income Tax Credit. For the purposes of the credit, the residency test includes any of the fifty states and the District of Columbia. Puerto Rico, Guam, and other U.S. possessions and territories are not included and therefore residing in these areas disqualifies you from claiming the EITC.
If you file jointly with your spouse, you both need to meet the residency test. There is no rule regarding the type of house you live in, as long as it is the place where you reside regularly. This can include homeless shelters and other housing, as long as it was within the United States as previously defined for half of the year.
Military personnel who are stationed outside the U.S. borders meet the residency test, even on extended active duty, for the duration of their duty period. This means they are eligible to claim the EITC, as long as they meet the other rules.