1

2つのボタンが付いた1つのアクティビティとメソッド付きの2つのボタンを備えたシンプルなAndroidアプリを構築しようとしていますがsetOnClickListener、エミュレーターでAndroidプロジェクトを実行しようとすると、アプリがインストールされません。

[2013-03-25 13:03:38 - MyHapiSample] Installation error: INSTALL_FAILED_UID_CHANGED
[2013-03-25 13:03:38 - MyHapiSample] Please check logcat output for more details.
[2013-03-25 13:03:38 - MyHapiSample] Launch canceled!

logcatビューで次のエラーが発生します

03-25 11:52:20.430: D/ExchangeService(630): Received deviceId from Email app: null
03-25 11:52:20.430: D/ExchangeService(630): !!! deviceId unknown; stopping self and   retrying
03-25 11:52:22.543: W/Trace(429): Unexpected value from nativeGetEnabledTags: 0
03-25 11:52:22.564: W/Trace(429): Unexpected value from nativeGetEnabledTags: 0
03-25 11:52:25.503: W/Trace(630): Unexpected value from nativeGetEnabledTags: 0
03-25 11:52:25.513: D/ExchangeService(630): !!! EAS ExchangeService, onCreate
03-25 11:52:25.523: W/Trace(630): Unexpected value from nativeGetEnabledTags: 0
03-25 11:52:25.523: W/Trace(630): Unexpected value from nativeGetEnabledTags: 0
03-25 11:52:25.523: D/ExchangeService(630): !!! EAS ExchangeService, onStartCommand,   startingUp = false, running = false
03-25 11:52:25.533: W/ActivityManager(274): Unable to start service Intent {  act=com.android.email.ACCOUNT_INTENT } U=0: not found
03-25 11:52:25.533: D/ExchangeService(630): !!! Email application not found; stopping  self
03-25 11:52:25.544: W/Trace(630): Unexpected value from nativeGetEnabledTags: 0
03-25 11:52:25.544: W/Trace(630): Unexpected value from nativeGetEnabledTags: 0
03-25 11:52:25.544: D/ExchangeService(630): !!! EAS ExchangeService, onStartCommand, startingUp = true, running = false
03-25 11:52:25.564: W/ActivityManager(274): Unable to start service Intent {  act=com.android.email.ACCOUNT_INTENT } U=0: not found
03-25 11:52:25.564: W/Trace(630): Unexpected value from nativeGetEnabledTags: 0
03-25 11:52:25.573: W/Trace(630): Unexpected value from nativeGetEnabledTags: 0
03-25 11:52:25.584: W/Trace(630): Unexpected value from nativeGetEnabledTags: 0
03-25 11:52:25.593: E/ActivityThread(630): Service  com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cecfc8 that was originally bound here
03-25 11:52:25.593: E/ActivityThread(630): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cecfc8 that was originally bound here
03-25 11:52:25.593: E/ActivityThread(630):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
03-25 11:52:25.593: E/ActivityThread(630):  at  android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
03-25 11:52:25.593: E/ActivityThread(630):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
03-25 11:52:25.593: E/ActivityThread(630):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
03-25 11:52:25.593: E/ActivityThread(630):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
03-25 11:52:25.593: E/ActivityThread(630):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
03-25 11:52:25.593: E/ActivityThread(630):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
03-25 11:52:25.593: E/ActivityThread(630):  at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
03-25 11:52:25.593: E/ActivityThread(630):  at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
03-25 11:52:25.593: E/ActivityThread(630):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
03-25 11:52:25.593: E/ActivityThread(630):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
03-25 11:52:25.593: E/ActivityThread(630):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
03-25 11:52:25.593: E/ActivityThread(630):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-25 11:52:25.593: E/ActivityThread(630):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-25 11:52:25.593: E/ActivityThread(630):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-25 11:52:25.593: E/ActivityThread(630):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-25 11:52:25.593: E/ActivityThread(630):  at java.lang.Thread.run(Thread.java:856)
03-25 11:52:25.615: E/StrictMode(630): null
03-25 11:52:25.615: E/StrictMode(630): android.app.ServiceConnectionLeaked: Service  com.android.exchange.ExchangeService has leaked ServiceConnection  com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cecfc8 that was originally  bound here

03-25 11:52:25.615: E/StrictMode(630):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
03-25 11:52:25.615: E/StrictMode(630):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
03-25 11:52:25.615: E/StrictMode(630):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
03-25 11:52:25.615: E/StrictMode(630):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
03-25 11:52:25.615: E/StrictMode(630):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
03-25 11:52:25.615: E/StrictMode(630):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
03-25 11:52:25.615: E/StrictMode(630):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
03-25 11:52:25.615: E/StrictMode(630):  at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
03-25 11:52:25.615: E/StrictMode(630):  at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
03-25 11:52:25.615: E/StrictMode(630):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
03-25 11:52:25.615: E/StrictMode(630):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
03-25 11:52:25.615: E/StrictMode(630):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
03-25 11:52:25.615: E/StrictMode(630):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-25 11:52:25.615: E/StrictMode(630):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-25 11:52:25.615: E/StrictMode(630):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-25 11:52:25.615: E/StrictMode(630):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-25 11:52:25.615: E/StrictMode(630):  at java.lang.Thread.run(Thread.java:856)
03-25 11:52:25.615: W/ActivityManager(274): Unbind failed: could not find connection for android.os.BinderProxy@41649e50

エラーの可能性があります。エミュレータは他のアプリでも正常に動作しています。Android API 4.2(17)を使用しています

これに関する助けをいただければ幸いです。

編集1

以下は、単一のアクティビティで構成される私のコードです。

package com.example.myhapisample;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

import java.io.IOException;

import ca.uhn.hl7v2.DefaultHapiContext;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.HapiContext;
import ca.uhn.hl7v2.model.Message;


import ca.uhn.hl7v2.parser.EncodingNotSupportedException;
import ca.uhn.hl7v2.parser.Parser;

import ca.uhn.hl7v2.model.v24.message.ADT_A01;
import ca.uhn.hl7v2.model.v24.segment.MSH;
import ca.uhn.hl7v2.model.v24.segment.PID;
import ca.uhn.hl7v2.model.v24.segment.PV1;
import ca.uhn.hl7v2.model.v24.segment.PV2;
import ca.uhn.hl7v2.model.v24.segment.NK1;
import ca.uhn.hl7v2.model.v24.segment.OBX;
import ca.uhn.hl7v2.model.v24.datatype.PN;
import ca.uhn.hl7v2.model.v24.datatype.XPN;

public class MyHapiSampleActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my_hapi_sample);

    System.out.println("HapiSample App screen launched");
     Button ParseMsgbutton=(Button)findViewById(R.id.button1);

     Button GenerateMsgbutton=(Button)findViewById(R.id.button2);

        ParseMsgbutton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {



             String msg = "MSH|^~\\&|HIS|RIH|EKG|EKG|199904140038||ADT^A01||P|2.2\r"
                          + "PID|0001|00009874|00001122|A00977|SMITH^JOHN^M|MOM|19581119|F|NOTREAL^LINDA^M|C|564 SPRING ST^^NEEDHAM^MA^02494^US|0002|(818)565-1551|(425)828-3344|E|S|C|0000444444|252-00-4414||||SA|||SA||||NONE|V1|0001|I|D.ER^50A^M110^01|ER|P00055|11B^M011^02|070615^BATMAN^GEORGE^L|555888^NOTREAL^BOB^K^DR^MD|777889^NOTREAL^SAM^T^DR^MD^PHD|ER|D.WT^1A^M010^01|||ER|AMB|02|070615^NOTREAL^BILL^L|ER|000001916994|D||||||||||||||||GDD|WA|NORM|02|O|02|E.IN^02D^M090^01|E.IN^01D^M080^01|199904072124|199904101200|199904101200||||5555112333|||666097^NOTREAL^MANNY^P\r"
                        + "NK1|0222555|NOTREAL^JAMES^R|FA|STREET^OTHER STREET^CITY^ST^55566|(222)111-3333|(888)999-0000|||||||ORGANIZATION\r"
                        + "PV1|0001|I|D.ER^1F^M950^01|ER|P000998|11B^M011^02|070615^BATMAN^GEORGE^L|555888^OKNEL^BOB^K^DR^MD|777889^NOTREAL^SAM^T^DR^MD^PHD|ER|D.WT^1A^M010^01|||ER|AMB|02|070615^VOICE^BILL^L|ER|000001916994|D||||||||||||||||GDD|WA|NORM|02|O|02|E.IN^02D^M090^01|E.IN^01D^M080^01|199904072124|199904101200|||||5555112333|||666097^DNOTREAL^MANNY^P\r"
                         + "PV2|||0112^TESTING|55555^PATIENT IS NORMAL|NONE|||19990225|19990226|1|1|TESTING|555888^NOTREAL^BOB^K^DR^MD||||||||||PROD^003^099|02|ER||NONE|19990225|19990223|19990316|NONE\r"
                          + "AL1||SEV|001^POLLEN\r"
                        + "GT1||0222PL|NOTREAL^BOB^B||STREET^OTHER STREET^CITY^ST^77787|(444)999-3333|(222)777-5555||||MO|111-33-5555||||NOTREAL GILL N|STREET^OTHER STREET^CITY^ST^99999|(111)222-3333\r"
                         + "IN1||022254P|4558PD|BLUE CROSS|STREET^OTHER STREET^CITY^ST^00990||(333)333-6666||221K|LENIX|||19980515|19990515|||PATIENT01 TEST D||||||||||||||||||02LL|022LP554";


                  * The HapiContext holds all configuration and provides factory methods for obtaining
                 * all sorts of HAPI objects, e.g. parsers. 

                   HapiContext context = new DefaultHapiContext();
                   System.out.println("HapiSample App Hapi Context created");

                  * A Parser is used to convert between string representations of messages and instances of
                * HAPI's "Message" object. In this case, we are using a "GenericParser", which is able to
                * handle both XML and ER7 (pipe & hat) encodings.

                  Parser p = context.getGenericParser();

                         Message hapiMsg;
                    try {
                        // The parse method performs the actual parsing
                        hapiMsg = p.parse(msg);
               } catch (EncodingNotSupportedException e) {
                          e.printStackTrace();
                        return;
                     } catch (HL7Exception e) {
                     e.printStackTrace();
                       return;
                     }


                     * This message was an ADT^A01 is an HL7 data type consisting of several components1, so we
                           * will cast it as such. The ADT_A01 class extends from Message, providing specialized
                          * accessors for ADT^A01's segments.
                          * 
                           * HAPI provides several versions of the ADT_A01 class, each in a different package (note
                           * the import statement above) corresponding to the HL7 version for the message.

                          ADT_A01 adtMsg = (ADT_A01)hapiMsg;

                     MSH msh = adtMsg.getMSH();

                    // Retrieve some data from the MSH segment
                         String msgType = msh.getMessageType().getMessageType().getValue();
                  String msgTrigger = msh.getMessageType().getTriggerEvent().getValue();
                  Log.e("Upto this working fine", "HL7 Message parsed properly");
                        // Prints "ADT A01"
                         System.out.println(msgType + " " + msgTrigger);


                          * Now let's retrieve the patient's name from the parsed message. 
                      * 
                          * PN is an HL7 data type consisting of several components, such as 
                     * family name, given name, etc. 

                         //XPN patientName = adtMsg.getPID().getPatientName();
                         //String obxObs=adtMsg.getOBX().getObservationValue().toString();
                         //System.out.println(obxObs);

                         // Prints "SMITH"
                       // String familyName = patientName.getFamilyName().getValue();
                       // System.out.println(familyName);


        }
    });

     GenerateMsgbutton.setOnClickListener(new View.OnClickListener() {

         public void onClick(View view){

             generateHL7Message();

         }
     });

}
@Override

public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_my_hapi_sample, menu);
    return true;
}

void generateHL7Message(){
    try{
    ADT_A01 adt = new ADT_A01();
    adt.initQuickstart("ADT", "A01", "P");

// Populate the MSH Segment
  MSH mshSegment = adt.getMSH();
  mshSegment.getSendingApplication().getNamespaceID().setValue("TestSendingSystem");
    mshSegment.getSequenceNumber().setValue("123");

    // Populate the PID Segment
PID pid = adt.getPID(); 
pid.getPatientName(0).getFamilyName().getSurname().setValue("Miki");
pid.getPatientName(0).getGivenName().setValue("Daniel");
   pid.getPatientIdentifierList(0).getID().setValue("123456");
pid.getPid23_BirthPlace().setValue("Ontario");

PV1 pv1=adt.getPV1();
pv1.getAdmissionType().setValue("Above normal");
pv1.getPatientClass().setValue("E");
pv1.getPatientType().setValue("Old Patient");   
pv1.getBedStatus().setValue("Occupied");
pv1.getDietType().getIdentifier().setValue("1");
pv1.getDietType().getText().setValue("Prescription");
pv1.getDietType().getCe3_NameOfCodingSystem().setValue("Internal");

PV2 pv2=adt.getPV2();
pv2.getAdmitReason().getIdentifier().setValue("P01");
pv2.getAdmitReason().getCe2_Text().setValue("Treatment");
pv2.getVisitDescription().setValue("FirstVisitToClinic");
pv2.getPreviousTreatmentDate().setYearMonthDayPrecision(2004, 11, 6);
pv2.getPatientConditionCode().getIdentifier().setValue("1");
pv2.getPatientConditionCode().getCe2_Text().setValue("Improving");
pv2.getPatientStatusEffectiveDate().setValue("");
pv2.getModeOfArrivalCode().getCe1_Identifier().setValue("67709");
pv2.getModeOfArrivalCode().getCe2_Text().setValue("ambulance");

NK1 nk1=adt.getNK1();
nk1.getNk127_Nationality().getCe2_Text().setValue("Indian");
nk1.getRelationship().getIdentifier().setValue("1");
nk1.getRelationship().getText().setValue("Brother");

OBX obx=adt.getOBX();
   obx.getDateTimeOfTheAnalysis().getTimeOfAnEvent().setDateMinutePrecision(2013,02,11,9,36);
obx.getObx3_ObservationIdentifier().getCe1_Identifier().setValue("1");
obx.getObx3_ObservationIdentifier().getText().setValue("Blood Pressure");
obx.getObx3_ObservationIdentifier().getAlternateText().setValue("Normal");
obx.getObx11_ObservationResultStatus().setValue("Result updated");
 /*
        * In a real situation, of course, many more segments and fields would be  populated
     */

// Now, let's encode the message and look at the output
 HapiContext context = new DefaultHapiContext();
    Parser parser = context.getPipeParser();
 String encodedMessage = parser.encode(adt);
 System.out.println("Printing HL7 Encoded Message:\n\n\n");
 System.out.println(encodedMessage);
 String outputHL7="\n\n\n\n\n\n"+encodedMessage;
    }
     catch(HL7Exception ex){
         Log.e("HL7 error", "HL7 exception");
     } 
     catch(IOException e){
         Log.e("IOException error", "msg");
     }
    }
}

HAPIライブラリによって提供されるいくつかのjarを使用して、HL7データを解析および生成しています。以前は、これらのjarを1つのボタンとで使用すると、エミュレーターでアプリが正常に動作していましたsetOnClickListenersetOnClickListenerしかし、別のボタンとそのメソッドを追加した後、エラーが発生しました。

私はこのエラーが来ることについて無知です。

助けてください。

4

2 に答える 2

2

この問題は、デバイスエミュレーターを実行 adb kill-serveradb start-serverて再作成したときに解決されました。また、アプリに使用しているサードパーティのjarファイルの一部をシャッフルする必要がありました。このエラーは、Androidエミュレーターのメモリリークに関係していると思います。ランタイム。

于 2013-03-29T06:05:12.280 に答える
0

との関係はわかりHAPIませんが、generateHL7Message()メソッドがをキャッチするためIOException、ネットワークに関連する何かを行おうとしている可能性があります。メインスレッドでのネットワーク接続は禁止されています。ネットワークの処理を順番に試し、メソッドAsyncTaskのGUI更新を行うことができますonPostExecute

于 2013-03-30T11:35:46.587 に答える