Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Sante Kotturi
Sante Kotturi
7,434 Points

Recovering Android Project Code / refactoring package name...

Ok so, I made it 99% of the way through the Blog Reader Android App. I wrote out all the code by hand. I built it in Android Studio instead of Eclipse, handled all the slight differences, no problem. I used this patch to get the data from the treehouse blog: https://teamtreehouse.com/forum/trying-to-retrieve-data-from-my-own-blog-help (i was getting the JSON unresolved string end...etc).

THEN, at the last step, where we added backwards compatibility for API 11 and older, things got funky. I ran the app on my nexus 5 running Android L and the API 11 version ran (no header bar...)

It was late and so I tried copying and pasting the previous step of the code from the video downloads to replace my existing code. Soon string's were missing (despite the exact string resource name "app_name" existing in strings.xml), I tried changing API versions in AndroidManifest.xml. Then things started to unwind, then neither layout rendered, lots of errors. I tried lots of tinkering, had two versions of the code opened, looking for differences line by line. I started pulling my now grayer hair out for now using git on this project. What I would have given for a:

    git fetch origin  
    git reset --hard origin/master

But no such luck. I then decided to start a new blank Project and then copy the exact files over. However, this lead to ridiculous package names: com.treehouse.blogreader.com.examples.me.blogreader.com.treehouse.blogreader...blah.

Android Studio would only let me refactor the last part of the package name (blogreader).

At this point I think I'm going to try opening up the source code from the second to last step (I dont really need to support andy v2.3.3 for my use) in sublime text, change all package names and SDK versions. Then try importing existing project from source code in Android Studio unless anyone has a better (less error prone) way of doing this?

Thanks in advance!