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 Build an Interactive Story App (Retired) Finishing the User Interface Customizing the Buttons

AndroidManifest.xml got wiped?

So I opened AndroidManifest.xml to make my second activity portrait only, and found that the manifest had been cleared of what was there before. The activities are missing. This is the contents of AndroidManifest.xml currently:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.alphonse.interactivestory" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" ></application>

</manifest>

After noticing this, I tried to run my app and it won't run anymore, I get an error saying there isn't a default activity. My app was working yesterday and I had edited the manifest before to make the other activity portrait only. I have no clue how this file got altered. Is there any way to restore the manifest file without starting the app from scratch?

2 Answers

Seth Kroger
Seth Kroger
56,413 Points

In Android Studio you can select from the menu VCS -> Local History -> Show History and revert to an earlier version from there.

Are you using a Version Control System like git? If so, you can go back to a previous commit and get the manifest file. Otherwise, you're likely going to have to rebuild the manifest file, but that would hopefully be the only thing that you would have to restore.