Question

I am a intermediate Java developer starting to look into developing Android apps. I am following the tutorials that Google provides, but I am running into an issue where Android Studio is removing code from the App Manifest. Specifically I am looking at this tutorial: https://developer.android.com/training/basics/firstapp/starting-activity.html

When I add these details to the AppManifest, Android studio removes them at compile time:

<activity
        android:name="com.example.myfirstapp.DisplayMessageActivity"
        android:label="@string/title_activity_display_message"
        android:parentActivityName="com.example.myfirstapp.MainActivity" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.example.myfirstapp.MainActivity" />
</activity>

Without these details, the app crashes because it does not know what the parent activity is.

Was it helpful?

Solution

One issue I can think of is that you are editing the wrong AndroidManifest which is present inside bin folder and not which is in the main project. That one obviously gets replaced always.

If its happening in other files of the code as well, then it might be that the place where you have your code is write protected. This can happen if you start eclipse from different user than where the code exists.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top