Android应用不会启动 [英] Android App won't launch

查看:104
本文介绍了Android应用不会启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在eclipse中制作一个Android应用程序,这是运行应用程序时遇到的以下错误:

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

这是MainActivity.java代码:

  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(launch);
}
}

以下是activity_main.xml代码:

 < 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
工具:context =。MainActivity >

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

< / RelativeLayout>

只是一点点背景,这是我第一次做一个Android应用程序,而应用程序是旨在与所有的Leap Motion传感器通信并完成。如果您有任何问题,请告诉我们,并且会有任何建议。



编辑:
现在得到这些错误:

  [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:警告:活动未启动,其当前任务已被带到前面

这里也是清单:

 <?xml version =1.0encoding =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>


解决方案

删除此部分:

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

这是正确的:

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

我回覆说,在这个问题



看看这是否会帮助你。 b $ b

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>

解决方案

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.

这篇关于Android应用不会启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆