1

I try to implement an application based on rscm (middleware). When I try to run on emulator, I get the errors listed below:

Error :03-27 16:58:20.490: E/Trace(1508): error opening trace file: No such file or directory (2)

03-27 21:53:21.610: D/AndroidRuntime(3803): Shutting down VM 03-27 21:53:21.610: W/dalvikvm(3803): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 03-27 21:53:21.760: E/AndroidRuntime(3803): FATAL EXCEPTION: main 03-27 21:53:21.760: E/AndroidRuntime(3803): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.context_application/com.example.context_application.MyContextAwareActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.context_application.MyContextAwareActivity" on path: /data/app/com.example.context_application-2.apk 03-27 21:53:21.760: E/AndroidRuntime(3803): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106) 03-27 21:53:21.760: E/AndroidRuntime(3803): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 03-27 21:53:21.760: E/AndroidRuntime(3803): at android.app.ActivityThread.access$600(ActivityThread.java:141) 03-27 21:53:21.760: E/AndroidRuntime(3803): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 03-27 21:53:21.760: E/AndroidRuntime(3803): at android.os.Handler.dispatchMessage(Handler.java:99) 03-27 21:53:21.760: E/AndroidRuntime(3803): at android.os.Looper.loop(Looper.java:137) 03-27 21:53:21.760: E/AndroidRuntime(3803): at android.app.ActivityThread.main(ActivityThread.java:5041) 03-27 21:53:21.760: E/AndroidRuntime(3803): at java.lang.reflect.Method.invokeNative(Native Method) 03-27 21:53:21.760: E/AndroidRuntime(3803): at java.lang.reflect.Method.invoke(Method.java:511) 03-27 21:53:21.760: E/AndroidRuntime(3803): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 03-27 21:53:21.760: E/AndroidRuntime(3803): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 03-27 21:53:21.760: E/AndroidRuntime(3803): at dalvik.system.NativeStart.main(Native Method) 03-27 21:53:21.760: E/AndroidRuntime(3803): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.context_application.MyContextAwareActivity" on path: /data/app/com.example.context_application-2.apk 03-27 21:53:21.760: E/AndroidRuntime(3803): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) 03-27 21:53:21.760: E/AndroidRuntime(3803): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 03-27 21:53:21.760: E/AndroidRuntime(3803): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 03-27 21:53:21.760: E/AndroidRuntime(3803): at android.app.Instrumentation.newActivity(Instrumentation.java:1054) 03-27 21:53:21.760: E/AndroidRuntime(3803): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097) 03-27 21:53:21.760: E/AndroidRuntime(3803): ... 11 more

Can anyone help?

package com.example.context;

import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import org.aspectsense.rscm.ContextValue;
import org.aspectsense.rscm.context.client.ContextListenerActivity;
import org.json.JSONException;

import java.util.Date;

public class MyContextAwareActivity extends ContextListenerActivity
{
    @Override public String[] getRequestedScopes()
    {
        return new String[] { "battery.level" };
    }

    private TextView messageTextView;

    @Override protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        messageTextView = new TextView(this);
        setContentView(messageTextView);
        appendMessage("Activity created");
    }

    private void appendMessage(final String message)
    {
        final String currentMessage = messageTextView.getText().toString();
        messageTextView.setText(currentMessage + "\n" + message);
    }

    @Override public void onContextValueChanged(ContextValue contextValue)
    {
       try
        {
            appendMessage(new Date() + ": The battery level is " +         contextValue.getValueAsInteger() + "%");
        }
        catch (JSONException jsone)
        {
            Toast.makeText(this, "Error while displaying context event: " + contextValue, Toast.LENGTH_SHORT).show();
        }
    }
}










<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.context"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>  
    <application
        android:allowBackup="true"
       android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.context.MyContextAwareActivity"
            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>
John_West
  • 2,239
  • 4
  • 24
  • 44

1 Answers1

0

You are telling it to write to external storage. Have you set up an SD card in eclipse?

Do any of these answers help? error opening trace file: No such file or directory (2)

Community
  • 1
  • 1
Display Name is missing
  • 6,197
  • 3
  • 34
  • 46
  • yes i have already setuo i am wondering if the layout.xml or main .xml can play a role for this error??? – Andreas Constantinou Mar 27 '13 at 19:22
  • Can you post the full error log or more of the stack trace? It sounds like the error might be in the code rather than the setup of the logging. – Display Name is missing Mar 27 '13 at 20:03
  • It failed because it did not find class com.example.context_application.MyContextAwareActivity. In your code the package is named com.example.context with no _application. Somewhere you need to fix the package reference. – Display Name is missing Mar 28 '13 at 14:49