-1

I'm making an android app in eclipse, and this is the following error I'm getting when I run the app:

[2014-07-03 17:39:30 - LeapMotionApp] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.leapmotionapp/.MainActivity }

Here is the MainActivity.java code:

package com.example.leapmotionapp;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import com.leapmotion.leap.*;
import com.leapmotion.leap.Gesture.State;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        System.out.println("launched");
    }
}

Here is the activity_main.xml code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

</RelativeLayout>

Just for a little background, this is my first go at making an Android app, and the App is intended to communicate with the Leap Motion sensor when all is said and done. Let me know if you have any questions, and any suggestions would be appreciated.

EDIT: Now getting these errors:

[2014-07-03 18:05:02 - LeapMotionApp] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.leapmotionapp/.MainActivity }
[2014-07-03 18:05:02 - LeapMotionApp] ActivityManager: Warning: Activity not started, its current task has been brought to the front

Here is the manifest also:

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <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>
    </application>

</manifest>
PenguinProgrammer
  • 141
  • 2
  • 5
  • 11

3 Answers3

0

You should not declare your activity there (on your activity_main.xml), declare it on your manifest if it isnt already there, should look a little like this

<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>

the line "android.intent.action.MAIN" means that this activity will be launched when starting your app, please share your manifest or check it out and look for this lines.

Ringo
  • 850
  • 9
  • 24
  • The manifest file is where you declare your activites and other things your whole application may use, for example – Ringo Jul 03 '14 at 22:03
  • That gives all of my activites permission to use internet, and wake the device on certain situations from shut down. There you MUST declare ALL of your activities. http://developer.android.com/guide/topics/manifest/manifest-intro.html – Ringo Jul 03 '14 at 22:04
  • can you look at my follow up answer above?? – PenguinProgrammer Jul 03 '14 at 22:15
  • "Activity not started, its current task has been brought to the front" means that the old version of your app was still running when you tried to launch the new version, so it wasn't reinstalled, just brought to the front. – Brodo Fraggins Jul 03 '14 at 22:49
  • Have you already deleted this from the layout? ` ` – Ringo Jul 03 '14 at 23:04
  • We need the error log, search for logcat on eclipse, are you using the right virtual device? – Ringo Jul 03 '14 at 23:07
  • In simple words, the manifest is where you declare all your aplication component. – Luis Pena Jul 04 '14 at 13:45
0

Running the application without declaring the activity in the manifest will usually result in Eclipse telling you exactly that. The manifest is called AndroidManifest.xml and you should be able to see it from the project explorer.

user2260040
  • 1,275
  • 1
  • 13
  • 26
0

Remove this part:

<activity
        android:name="com.example.leapmotionapp.MainActivity"
        android:label="@string/app_name" >
</activity> 

Here is correct:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

</RelativeLayout>

I replied that on this issue

See if this will help you.

Community
  • 1
  • 1
Cícero Moura
  • 2,027
  • 1
  • 24
  • 36