简体   繁体   中英

Getting error :- unfortunately app has stopped in android

I have been searching for this for hours but all in vain.I am developing a tutorial app named Yamba from the book learning android .It is an app to update status on twitter.It uses jtwitter.jar library. Things which I am using :

  1. linux(ubuntu)
  2. ant debug ( to build my project)
  3. my android phone for testing the app.

The project builds successfully and installs the app on my phone but when I run the app, I get the error " unfortunately, Yamba has stopped ".I have the following files:

AndroidManifest.xml file as--

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

my Yamba.java file as --

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");
    }
}

my layout.xml as ----

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

my logcat is as follows ---

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

Clueless about what to do now. Any help in this regard would be deeply appreciated.

EDIT -- I have posted my new logcat after removing the typo.

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

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

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

there is a typo error in android. persmission .INTERNET

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM