得到错误: - 不幸的是app已停止在android中

时间:2015-08-13 15:54:47

标签: java android xml ant logcat

我一直在寻找这个好几个小时,但都是徒劳的。我正在从学习android 这本书开发一个名为Yamba的教程应用程序。它是一个在twitter上更新状态的应用程序。它使用{ {3}}库。我正在使用的东西:

  
      
  1. 的Linux(Ubuntu的)
  2.   
  3. ant debug(构建我的项目)
  4.   
  5. 我的Android手机用于测试该应用。
  6.   

项目构建成功并在我的手机上安装应用程序,但是当我运行应用程序时,我收到错误“,很遗憾,Yamba已停止”。我有以下文件:

AndroidManifest.xml文件为 -

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.Yamba"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
        <activity android:name=".Yamba"
                  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>
    <uses-permission android:name="android.permission.INTERNET"/>
</manifest>
                 

我的Yamba.java文件为 -

package com.example.Yamba;

import winterwell.jtwitter.Twitter;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.Button;
public class Yamba extends Activity implements OnClickListener
{
    private static final String TAG = "Yamba";
    EditText editText;
    Button updateButton;
    Twitter twitter;
    /** Called when the activity is first created. */
    @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.status);

            //find views
            editText =(EditText) findViewById(R.id.editText);
            updateButton =(Button) findViewById(R.id.buttonUpdate);

            updateButton.setOnClickListener(this);
            twitter = new Twitter("student","password");
            twitter.setAPIRootUrl("http://yamba.marakana.com/api");
        }
    public void onClick(View view){
        twitter.setStatus(editText.getText().toString());
        Log.d(TAG,"onClicked");
    }
}

我的layout.xml为----

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
  <TextView
          android:id="@+id/text"    
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:text="@string/titleStatus"
    android:textSize="30sp"
    />
  <EditText
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:hint="@string/hintText"
    android:id="@+id/editText"
    android:gravity="top|center_horizontal">
  </EditText>
  <Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/buttonUpdate"
    android:textSize="20sp"
    android:id="@+id/buttonUpdate">
  </Button>
</LinearLayout>

我的logcat如下---

--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
E/ObjectHelper( 6376): Can't find method:setCompatibilityInfo
E/Trace   ( 6342): error opening trace file: No such file or directory (2)
E/jdwp    ( 6342): jdwp::setsockopt(SO_SNDTIMEO)
E/jdwp    ( 6342): jdwp::setsockopt(SO_RCVTIMEO)
E/KeyguardUpdateMonitor(  508): Object tried to add another callback
E/KeyguardUpdateMonitor(  508): java.lang.Exception: Called by
E/KeyguardUpdateMonitor(  508):         at com.android.internal.policy.impl.keyguard.KeyguardUpdateMonitor.registerCallback(KeyguardUpdateMonitor.java:1107)
E/KeyguardUpdateMonitor(  508):         at com.android.internal.policy.impl.keyguard.KeyguardSelectorView.onResume(KeyguardSelectorView.java:331)
E/KeyguardUpdateMonitor(  508):         at com.android.internal.policy.impl.keyguard.KeyguardHostView.onScreenTurnedOn(KeyguardHostView.java:1118)
E/KeyguardUpdateMonitor(  508):         at com.android.internal.policy.impl.keyguard.KeyguardViewManager.onScreenTurnedOn(KeyguardViewManager.java:404)
E/KeyguardUpdateMonitor(  508):         at com.android.internal.policy.impl.keyguard.KeyguardViewMediator.handleNotifyScreenOn(KeyguardViewMediator.java:1775)
E/KeyguardUpdateMonitor(  508):         at com.android.internal.policy.impl.keyguard.KeyguardViewMediator.access$2300(KeyguardViewMediator.java:106)
E/KeyguardUpdateMonitor(  508):         at com.android.internal.policy.impl.keyguard.KeyguardViewMediator$4.handleMessage(KeyguardViewMediator.java:1413)
E/KeyguardUpdateMonitor(  508):         at android.os.Handler.dispatchMessage(Handler.java:107)
E/KeyguardUpdateMonitor(  508):         at android.os.Looper.loop(Looper.java:194)
E/KeyguardUpdateMonitor(  508):         at android.os.HandlerThread.run(HandlerThread.java:60)
E/AudioMTKHardware(  137): setParameters() still have param.size() = 1, remain param = "screen_state=on"
E/CellLocation(  784): create GsmCellLocation
E/CellLocation(  784): create GsmCellLocation
E/AndroidRuntime( 6411): FATAL EXCEPTION: main
E/AppErrorDialog(  508): Failed to get ILowStorageHandle instance

对现在该做什么一无所知。 在这方面的任何帮助将深表感谢。

编辑 - 删除错字后我发布了新的logcat。

2 个答案:

答案 0 :(得分:3)

<uses-permission android:name="android.persmission.INTERNET"/>

错误地命名权限......应该是:

<uses-permission android:name="android.permission.INTERNET"/>

答案 1 :(得分:1)

android中存在拼写错误。 persmission .INTERNET