开发者

why does .apk is not getting installed in android emulator?

开发者 https://www.devze.com 2023-02-15 05:55 出处:网络
I tried the following code with android 2.3.3 (AVD). When i run this code it waits saying Waiting for HOME (\'android.process.acore\') to be launched... but keeps on waiting. So i tried running second

I tried the following code with android 2.3.3 (AVD). When i run this code it waits saying Waiting for HOME ('android.process.acore') to be launched... but keeps on waiting. So i tried running second time .. this time it says

[2011-03-04 12:28:39 - DialANumber] Uploading DialANumber.apk onto device 'emulator-5554' [2011-03-04 12:28:39 - DialANumber] Installing DialANumber.apk... [2011-03-04 12:29:14 - DialANumber] HOME is up on device 'emulator-5554' [2011-03-04 12:29:14 - DialANumber] Uploading DialANumber.apk onto device 'emulator-5554' [2011-03-04 12:29:14 - DialANumber] Installing DialANumber.apk...

and after some time fails with

[2011-03-04 12:31:37 - DialANumber] Failed to install DialANumber.apk on device 'emulator-5554! [2011-03-04 12:31:37 - DialANumber] (null) [2011-03-04 12:31:39 - DialANumber] Launch canceled!

the code follows:

package com.DialANumber;

import android.app.Activity;

import android.content.Intent;

import android.net.Uri;

import android.os.Bundle;

import android.view.KeyEvent;

import android.view.View;

import android.widget.Button;

import android.widget.EditText;

import android.widget.LinearLayout;


public class DialANumber extends Activity {

EditText mEditText_number = null;

LinearLayout mLinearLayout_no_button = null;

Button mButton_dial = null;


@Override
public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

mLinearLayout_no_button = new LinearLayout(this);

mEditText_number = new EditText(this);
mEditText_number.setText("5551222");
mLinearLayout_no_button.addView(mEditText_number);

mButton_dial = new Button(this);
mButton_dial.setText("Dial!");
mLinearLayout_no_button.addView(mButton_dial);
mButton_dial.setOnClickListener(new View.OnClickListener() {
  public void onClick(View v) {
    performDial();
  }
});

  s开发者_C百科etContentView(mLinearLayout_no_button);
 }

 public boolean onKeyDown(int keyCode, KeyEvent event) {

if (keyCode == KeyEvent.KEYCODE_CALL) {

  performDial();

  return true;

}
return false;
}

 public void performDial(){

if(mEditText_number!=null){

  try {

    startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + mEditText_number.getText())));

  } catch (Exception e) {

    e.printStackTrace();

  }
}//if
}
}

I am just starting to learn developing android apps. please help me out.. Thanks.


you have to provide virtual SDCard for the emulator. You can do this easily when creating emulator from eclipse widget

if you are not an eclipse user, you can refer to this link http://wrestlingmind.blogspot.com/2009/06/android-emulator-handy-commands.html

0

精彩评论

暂无评论...
验证码 换一张
取 消