0

I'm working on my first android app using the walk-through provided by Android and I'm running into a problem (well, more than a few, but I can't find a solution to this one).

When I try to run the app in the Emulator I get the following error:

am get-config: retrieve the configuration and any recent configurations of the device

<INTENT> specifications include these flags and arguments:
[-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--esn <EXTRA_KEY> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[--el <EXTRA_KEY> <EXTRA_LONG_VALUE> ...]
[--ef <EXTRA_KEY> <EXTRA_FLOAT_VALUE> ...]
[--eu <EXTRA_KEY> <EXTRA_URI_VALUE> ...]
[--ecn <EXTRA_KEY> <EXTRA_COMPONENT_NAME_VALUE>]
[--eia <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]
[--ela <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]
[--efa <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]
[--esa <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]
(to embed a comma into a string escape it using "\,")
[-n <COMPONENT>] [-f <FLAGS>]
[--grant-read-uri-permission] [--grant-write-uri-permission]
[--grant-persistable-uri-permission] [--grant-prefix-uri-permission]
[--debug-log-resolution] [--exclude-stopped-packages]
[--include-stopped-packages]
[--activity-brought-to-front] [--activity-clear-top]
[--activity-clear-when-task-reset] [--activity-exclude-from-recents]
[--activity-launched-from-history] [--activity-multiple-task]
[--activity-no-animation] [--activity-no-history]
[--activity-no-user-action] [--activity-previous-is-top]
[--activity-reorder-to-front] [--activity-reset-task-if-needed]
[--activity-single-top] [--activity-clear-task]
[--activity-task-on-home]
[--receiver-registered-only] [--receiver-replace-pending]
[--selector]
[<URI> | <PACKAGE> | <COMPONENT>]

Error: Bad component name: com.example.sir.geo_app/

Here's my Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.sir.geo_app" >
      <uses-sdk
      android:minSdkVersion="7"
      android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/CustomActionBarTheme" >
        <activity
            android:name=".MainActivity"
            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=".DisplayMessageActivity"
            android:label="@string/title_activity_display_message"
            android:parentActivityName=".MyActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.sir.geo_app.MyActivity" />
        </activity>
    </application>

</manifest>

Any help would be gratefully appreciated.

Thanks in advance!

Matt M
  • 3
  • 3

2 Answers2

0

You can't have an "_" in your java package name. So com.example.sir.geo_app should be com.example.sir.geo.app or com.example.sir.geoapp.

In Android this is illegal, see the answer here: Android - Package Name convention.

In Java, it should be alright: http://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html.

Community
  • 1
  • 1
Jared Burrows
  • 54,294
  • 25
  • 151
  • 185
  • This is proving to be problematic. Here's what I've done so far.. I renamed the folder Geoapp, and went through and edited all of the package and app names from geo_app to geoapp. I'n now getting errors in the DisplayMessageActivity saying that package R does not exist. – Matt M Mar 16 '15 at 02:58
  • `/Users/Sir/Desktop/AndroidStudioProjects/Geoapp/app/src/main/java/com/example/sir/geo_app/DisplayMessageActivity.java Error:(15, 21) package R does not exist Error:(21, 44) cannot find symbol variable MyActivity Error:(41, 20) package R does not exist /Users/Sir/Desktop/AndroidStudioProjects/Geoapp/app/src/main/java/com/example/sir/geo_app/MyActivity.java Error:(49, 42) cannot find symbol class DisplayMessageActivity` – Matt M Mar 16 '15 at 02:59
  • How do I change the location that it looks for the files in? – Matt M Mar 16 '15 at 03:00
  • All you have to do is Change the Package name. Right-click -> refactor -> rename. – Jared Burrows Mar 16 '15 at 03:02
  • 1
    I just tried but it requires 15 points. I certainly will when I get the privileges – Matt M Mar 16 '15 at 03:58
  • Hmm.. I had to troubleshoot through a bunch of errors from moving the files, and I think I was premature in marking this as complete. I'm still receiving the Bad component error: com.example.sir.geo_app/ – Matt M Mar 16 '15 at 04:30
  • I had used the Rightclick > refactor > rename function to rename all of the mentions of geo_app to geoapp – Matt M Mar 16 '15 at 04:32
  • @MattM Not premature, you are on the right track. Is there anything else I can help you with? – Jared Burrows Mar 16 '15 at 05:06
  • Thanks - I'm still getting the same error about the Bad component error: com.example.sir.geo_app even the name had been changed using the Refactor > Rename process. Here is my manifest: http://imgur.com/ZWlSJJK I also noticed that the – Matt M Mar 16 '15 at 14:49
  • Are you using Android Studio, correct? Did you just start this project? Have you tried cleaning it? If your project is not that large, I'd simply create a new one with the CORRECT package name and copy your code over. – Jared Burrows Mar 16 '15 at 15:32
  • Yeah, correct. I'm using Android Studio. I tried using the Clean function, and also the Invalidade Caches/Restart and neither worked in fixing the error. Here's the message I get when trying to use the Emulator. – Matt M Mar 16 '15 at 17:11
  • `Waiting for device. Target device: Galaxy_Nexus_API_21 [emulator-5554] Uploading file local path: /Users/Sir/Desktop/AndroidStudioProjects/Geo-App/app/build/outputs/apk/app-debug.apk remote path: /data/local/tmp/com.example.sir.geo_app Installing com.example.sir.geo_app DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.sir.geo_app" pkg: /data/local/tmp/com.example.sir.geo_app Success ` – Matt M Mar 16 '15 at 17:12
  • Post your `build.grade`. Maybe you are renamed your packages in there. Like I said, the best way is simply to copy your sources to a new project. Just name your project correctly the first time. – Jared Burrows Mar 16 '15 at 17:24
  • Ideally I'd like to figure this out instead of redoing it as there's lots of files that I've created and I don't want to overlook something and run through more troubleshooting than is necessary. – Matt M Mar 16 '15 at 17:42
  • You have not been able to run the app at all correct? This is why you asked the question in the first place. Do you even have a lot of code in your app? Its hard to debug it through pictures. – Jared Burrows Mar 16 '15 at 17:47
  • Correct - the Run stops with the error, and if I try to click on the icon in the emulator I get a Unfortunately, My first App has stopped. – Matt M Mar 16 '15 at 18:06
  • I really have done all I can here. You just started this project. You should not have named your project with an "_" inside of it. To be safe, I would create a new project and add your code to that one. – Jared Burrows Mar 16 '15 at 18:11
  • I appreciate your help! I'm in the process of redoing the project now based on your suggestion – Matt M Mar 16 '15 at 18:12
  • Anytime! Let me know if I can help on anything else. – Jared Burrows Mar 16 '15 at 18:12
0

Your home/ root package should follow these standerds,

com.adobe.reader (Adobe Reader)

com.adobe.photoshop (Adobe Photoshop)

com.adobe.ideas (Adobe Ideas)

like wise ...