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 trialRobert Camargo
1,016 PointsThe app doesn't run in the emulator. What should I do?
I have followed the steps in order to create an emulator and tried running my app. However the app does not run through the emulator and I am given an error message that reads "Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]". I have followed each step as shown in the video and tried recreating the app but am met with the same result each time. What should I do to fix this?
Robert Camargo
1,016 Points/Users/robcam89/AndroidStudioProjects/FunFacts2/app/src/main/AndroidManifest.xml
Here you go. And thank you very much for your assistance. It is greatly appreciated. :)
Harry James
14,780 PointsHey again Robert!
Can you please provide the contents of that file for me?
Thanks in advance! :)
Robert Camargo
1,016 PointsI'm sorry. I'm not sure how to provide you with the file. I thought dragging and dropping it into the comment space would work. How do I provide you with the file? I apologize I'm new to all of this stuff here on Treehouse.
Harry James
14,780 PointsNo problem and welcome to the forums :D
You'll have to paste the actual contents of the file in the message itself. When you do so, it won't look pretty! I'll be sure to format the code for you so that it can be read easily by other users. You can then just look in the Edit section of your post to see how I changed it - I think this is the easiest way to explain how forum users can format their code.
If you do want to try it out yourself though, you can format code like this:
``` java
your code goes here
```
In this case java is the language we're formatting.
Don't worry about getting it working though - you may prefer just to wait and see how I edit it (You'll understand what I'm saying then!). Speak to you soon :)
Robert Camargo
1,016 Points<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="RobertCamargo.funfacts" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".FunFactsActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Robert Camargo
1,016 PointsIs this correct?
Harry James
14,780 PointsIn this case, yes! The forums do try to auto-format code which worked in this case but I have also edited your post so that you know how to format the code if it didn't format correctly in the future.
I've also worked out what is causing your problem and am just writing my answer for you now :)
2 Answers
Harry James
14,780 PointsHey again Robert!
The reason you're getting this error is because you have capitalization in your package name which Parse does not allow. You need to rename your package name from RobertCamargo.funfacts to robertcamargo.funfacts (I know, it's annoying).
To do this, right-click on your package in the java folder of Android Studio and press Refactor then Rename. Then, enter the new name (robertcamargo.funfacts
). After that, press Rename package. Make sure that you have all boxes on the dialog checked else you may get errors in your xml files. Finally, press Preview and then OK.
If you still have errors, go to Build and then press Clean Project (This will just refresh the error checks).
If you still have errors after that, open up your AndroidManifest.xml file and look for any errors (Sometimes refactoring the package name doesn't quite work well for XML files). Usually, you'll understand what's gone wrong and will be able to manually correct it. If you still have errors and don't understand how to fix them, paste your AndroidManifest.xml file's contents onto here and I'll take a look :)
Hope it helps and happy coding ;)
Robert Camargo
1,016 PointsWhen I try to rename the package as you stated it tells me that it is not a valid identifier.
Harry James
14,780 PointsHi there!
Looks like things have changed in Android Studio since I've done this and now it only seems to change the last part of the package.
To fix this, click on your package in Android Studio and then press the cog icon. Here, uncheck Compact Empty Middle Packages. Your package will then split out into 3 parts:
As you want to change the middle part of your package (That's where the capitalization is), right-click on this (The RobertCamargo
bit) and refactor that. For the new name, type robertcamargo
without capitalization.
That should then fix your problem but if you still have issues, look at my main response to see what to do.
Hope it helps and if you have any more problems, give me a shout :)
Robert Camargo
1,016 PointsSorry for the late response. I've been out of town dealing with a family matter. But this worked and now I am back on track. Thank you very much for taking your time to help me out and teaching me new things about Android Studio. I am very grateful for your assistance.
Harry James
14,780 PointsNo problem!
If my answer helped you, be sure to mark it as the Best Answer - it credits me and also lets other users know that the question has been answered.
Hope to see you around on the forums more! Have fun :)
Harry James
14,780 PointsHarry James
14,780 PointsHey Robert!
That means that your AndroidManifest.xml file is corrupt! Please provide it here and I'll see if I can fix it for you.
Speak to you soon! :)