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

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 36,143 Points

Animations and Transitions Part 1 package issue

I downloaded the code for the album cover app and I've been coding along. The code is valid (i.e no redlines) and when I run in the emulator it loads. But when I click on one of the covers I get this message:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jimulabs.googlemusicmock/com.teamtreehouse.albumcover .AlbumDetailActivity}: java.lang.IllegalArgumentException: AppIndex: The URI host must match the package name and follow the format (android-app://<package_name>/<scheme>/[host_path]). Provided URI: android-app://com.teamtreehouse.albumcover/http/host/path

I haven't modified the package name or anything near it. Should I save the code in sublime text, delete the app and rebuild it in my own version of Studio's package?

thanks

NJM

Nancy Melucci
Nancy Melucci
Courses Plus Student 36,143 Points

I got it to work, once. Then it started doing the same thing. To restate...the app runs and shows the opening page. But it "Stops working" when I click on any album detail. It complains about the URI as above and I can't get anything else to happen. I am following Ben's instructions and there are no redlines. I am getting a lot out of this tutorial but I would like to see the app actually run. Does anyone know what the code above means and how I can fix it?

4 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Hi Nancy,

Sorry for the delayed response here! Because I worked on this project with Linton, the original code had the package structure you see in that error: "com.jimulabs.googlemusicmock"

Your error also includes the correct Treehouse package, but I don't know how they got joined like this: com.jimulabs.googlemusicmock/com.teamtreehouse.albumcover

I downloaded the project files from GitHub and mine have the correct package name and structure. Can you check your manifest and file structure? See if they're the same as these:

AndroidManifest.xml

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.teamtreehouse.albumcover.AlbumListActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.teamtreehouse.albumcover.AlbumDetailActivity"
            android:theme="@style/AppTheme.Dark"
            android:label="@string/title_activity_album_detail" >
        </activity>
    </application>

</manifest>

Project structure

If you can't troubleshoot the difference based on these, zip up your files or post them somewhere and send them to me or share a link here and I can take a look at your actual project files.

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 36,143 Points

Thank you Ben. I am definitely going to take another run at it this weekend, before my fall teaching schedule becomes too oppressive. Having half written apps lying around makes me...sad.

I'll let you know what happens.

have a good weekend.

Nancy M.

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 36,143 Points

I see what you mean about the joined package names. The problem is, I cannot find the code for the correct URI to parse. Under the video, in the "downloads" area, where project files usually are, there are videos. No code that I can check what I had in my file against. I've checked under most of the videos, with similar results. Videos only, no code.

Or can you send me the link to git so I can see what is in that section of AlbumDetailActivity.java?

thanks.

Nancy M.

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Interesting - they should definitely be on each video! I just checked and they were missing from "Defining Animations in XML" (I fixed it).

Here's the link you need: All project files

Can you still not see project files? I may need to follow up with our support team on that.

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 36,143 Points

Thank you so much! I would like to finish this one over the weekend. I appreciate your help.

Look forward to more Android courses soon. NJM