Fatal exception: main android eclipse - java

I have viewed most of the other threads regarding this error but have not found an answer.
I started a new project a couple of weeks ago using a plugin and the example project with the plugin. Added various of my own features and designs and no problems running the project.
Then updated to ADT 17 2 days ago and this seriously messed things up for me. Started getting class path errors to name a few. I then reverted back to adt 16 which fixed the errors and my project compiles fine but as soon as i run it it crashes on the test device.
I have checked that my compliance level is correct, checked library paths, api versions, manifest xml, basically everything. I do not get how something that use to work perfectly can now just not work.
I proceeded to unistall everything and did a reinstall on the sdk's ADT and java, but to no avail, even just trying to run the example project just crashes.
I have aslo uninstalled the app from the device and rbooted the device and cleared the cache. I am at the end of my rope. Like i say, i have checked libraries and everything, its just this runtime error.
I also increased the connection time out, and added "android:installLocation="preferExternal" to my manifest, no change.
Please help, there cant be an issue with the code as it worked perfectly.
Please see the code for the starting activity:
package com.yourcompany.junaioplugin.template;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import com.yourcompany.junaioplugin.template.R;
import com.metaio.junaio.plugin.JunaioPlugin;
public class SplashActivity extends Activity
{
static
{
JunaioPlugin.loadNativeLibs();
}
/**
* standard tag used for all the debug messages
*/
public static final String TAG = "junaioPluginTemplate";
/**
* Display log messages with debug priority
*
* #param msg Message to display
* #see Log#d(String, String)
*/
public static void log(String msg)
{
if (msg != null)
Log.d(TAG, msg);
}
/**
* Progress dialog
*/
private ProgressDialog progressDialog;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView( R.layout.main );
JunaioStarterTask junaioStarter = new JunaioStarterTask();
junaioStarter.execute(1);
}
private class JunaioStarterTask extends AsyncTask<Integer, Integer, Integer>
{
#Override
protected void onPreExecute()
{
progressDialog = ProgressDialog.show(SplashActivity.this, "junaio", "Starting up...");
}
#Override
protected Integer doInBackground(Integer... params)
{
// Set authentication if a private channel is used
// JunaioPlugin.setAuthentication("username", "password");
// Start junaio, this will initialize everything the plugin need
int result = JunaioPlugin.startJunaio(this, getApplicationContext());
return result;
}
#Override
protected void onProgressUpdate(Integer... progress)
{
}
#Override
protected void onPostExecute(Integer result)
{
if (progressDialog != null)
{
progressDialog.cancel();
progressDialog = null;
}
switch (result)
{
case JunaioPlugin.ERROR_EXSTORAGE:
SplashActivity.log("External storage is not available, closing...");
finish();
break;
case JunaioPlugin.ERROR_INSTORAGE:
SplashActivity.log("Internal storage is not available, closing...");
finish();
break;
case JunaioPlugin.CANCELLED:
SplashActivity.log("Starting junaio cancelled");
break;
case JunaioPlugin.SUCCESS:
JunaioPlugin.setAuthentication("junaioTester", "test123");
launchLiveView();
break;
}
}
}
/**
* Launch junaio live view
*/
private void launchLiveView()
{
startActivity(new Intent(this, JunaioARViewTestActivity.class));
finish();
}
#Override
protected void onResume()
{
super.onResume();
}
#Override
protected void onPause()
{
super.onPause();
}
#Override
protected void onStop()
{
super.onStop();
if (progressDialog != null)
{
progressDialog.cancel();
progressDialog = null;
}
}
}
Here is the logcat:
03-27 10:47:47.543: I/dalvikvm(10641): Could not find method com.metaio.junaio.plugin.JunaioPlugin.loadNativeLibs, referenced from method com.yourcompany.junaioplugin.template.SplashActivity.<clinit>
03-27 10:47:47.543: W/dalvikvm(10641): VFY: unable to resolve static method 65: Lcom/metaio/junaio/plugin/JunaioPlugin;.loadNativeLibs ()V
03-27 10:47:47.543: D/dalvikvm(10641): VFY: replacing opcode 0x71 at 0x0000
03-27 10:47:47.543: D/dalvikvm(10641): VFY: dead code 0x0003-0003 in Lcom/yourcompany/junaioplugin/template/SplashActivity;.<clinit> ()V
03-27 10:47:47.543: W/dalvikvm(10641): Unable to resolve superclass of Lcom/yourcompany/junaioplugin/template/JunaioARViewTestActivity; (48)
03-27 10:47:47.543: W/dalvikvm(10641): Link of class 'Lcom/yourcompany/junaioplugin/template/JunaioARViewTestActivity;' failed
03-27 10:47:47.547: E/dalvikvm(10641): Could not find class 'com.yourcompany.junaioplugin.template.JunaioARViewTestActivity', referenced from method com.yourcompany.junaioplugin.template.SplashActivity.launchLiveView
03-27 10:47:47.547: W/dalvikvm(10641): VFY: unable to resolve const-class 78 (Lcom/yourcompany/junaioplugin/template/JunaioARViewTestActivity;) in Lcom/yourcompany/junaioplugin/template/SplashActivity;
03-27 10:47:47.547: D/dalvikvm(10641): VFY: replacing opcode 0x1c at 0x0002
03-27 10:47:47.547: D/dalvikvm(10641): VFY: dead code 0x0004-000d in Lcom/yourcompany/junaioplugin/template/SplashActivity;.launchLiveView ()V
03-27 10:47:47.547: W/dalvikvm(10641): Exception Ljava/lang/NoClassDefFoundError; thrown during Lcom/yourcompany/junaioplugin/template/SplashActivity;.<clinit>
03-27 10:47:47.547: W/dalvikvm(10641): Class init failed in newInstance call (Lcom/yourcompany/junaioplugin/template/SplashActivity;)
03-27 10:47:47.547: D/AndroidRuntime(10641): Shutting down VM
03-27 10:47:47.547: W/dalvikvm(10641): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
03-27 10:47:47.555: E/AndroidRuntime(10641): FATAL EXCEPTION: main
03-27 10:47:47.555: E/AndroidRuntime(10641): java.lang.ExceptionInInitializerError
03-27 10:47:47.555: E/AndroidRuntime(10641): at java.lang.Class.newInstanceImpl(Native Method)
03-27 10:47:47.555: E/AndroidRuntime(10641): at java.lang.Class.newInstance(Class.java:1429)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.os.Handler.dispatchMessage(Handler.java:99)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.os.Looper.loop(Looper.java:123)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-27 10:47:47.555: E/AndroidRuntime(10641): at java.lang.reflect.Method.invokeNative(Native Method)
03-27 10:47:47.555: E/AndroidRuntime(10641): at java.lang.reflect.Method.invoke(Method.java:521)
03-27 10:47:47.555: E/AndroidRuntime(10641): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
03-27 10:47:47.555: E/AndroidRuntime(10641): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-27 10:47:47.555: E/AndroidRuntime(10641): at dalvik.system.NativeStart.main(Native Method)
03-27 10:47:47.555: E/AndroidRuntime(10641): Caused by: java.lang.NoClassDefFoundError: com.metaio.junaio.plugin.JunaioPlugin
03-27 10:47:47.555: E/AndroidRuntime(10641): at com.yourcompany.junaioplugin.template.SplashActivity.<clinit>(SplashActivity.java:19)
03-27 10:47:47.555: E/AndroidRuntime(10641): ... 15 more
Here is the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="3"
android:versionName="3.5.1" package="com.yourcompany.junaioplugin.template"
android:installLocation="preferExternal">
<!-- The application must be compiled using Google APIs (Android 3.0) -->
<!-- However, target and min SDK can be 8 (Android 2.2) -->
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false"/>
<uses-feature android:name="android.hardware.sensor.compass" android:required="false"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<application
android:label="#string/app_name"
android:icon="#drawable/icon"
android:debuggable="true">
<uses-library android:name="com.google.android.maps" />
<!-- Start screen -->
<activity android:name=".SplashActivity"
android:theme="#style/Theme.Fullscreen"
android:screenOrientation="portrait"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- junaio AR view activity -->
<activity
android:name=".JunaioARViewTestActivity"
android:theme="#style/Theme.Fullscreen"
android:configChanges="orientation"
android:screenOrientation="landscape">
</activity>
<activity
android:name="com.metaio.junaio.plugin.view.POIDetailDialog"
android:theme="#style/Theme.POIDialog"
android:screenOrientation="landscape">
</activity>
<activity
android:name="com.metaio.junaio.plugin.view.WebViewActivity"
android:theme="#style/Theme.Fullscreen"
android:configChanges="orientation">"
</activity>
<activity
android:name="com.metaio.junaio.plugin.view.ImageViewActivity"
android:theme="#style/Theme.Fullscreen"
android:configChanges="orientation">
</activity>
</application>
</manifest>

For me, when I installed ADT 17 I have problems using 3rd party libraries (It kept telling me there were duplications). It turns out that they no longer need to be added to the build path; just kept in a folder in the root of your project called "libs". Could this be the same problem?

Related

Why is there a class missing when I compile my app?

I'm trying to implement drive storage into my app, and I'm having a bit of an issue getting it to run. It compiles fine (no errors), but there's some class files getting lost somewhere. The error when launching my app is as follows:
01-24 18:40:09.747 1038-8218/? I/ActivityManager﹕ Start proc net.rymate.notes for activity net.rymate.notes/.activities.NotesListActivity: pid=6099 uid=10102 gids={50102, 3003}
01-24 18:40:09.748 1038-1103/? D/WifiStateMachine﹕ handleMessage: X
01-24 18:40:09.772 6099-6105/? D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
01-24 18:40:09.814 6099-6099/? I/dalvikvm﹕ Failed resolving Lnet/rymate/notes/storage/GoogleDriveStorage; interface 1582 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
01-24 18:40:09.815 6099-6099/? W/dalvikvm﹕ Link of class 'Lnet/rymate/notes/storage/GoogleDriveStorage;' failed
01-24 18:40:09.815 6099-6099/? E/dalvikvm﹕ Could not find class 'net.rymate.notes.storage.GoogleDriveStorage', referenced from method net.rymate.notes.activities.NotesListActivity.onCreate
01-24 18:40:09.815 6099-6099/? W/dalvikvm﹕ VFY: unable to resolve new-instance 1949 (Lnet/rymate/notes/storage/GoogleDriveStorage;) in Lnet/rymate/notes/activities/NotesListActivity;
01-24 18:40:09.815 6099-6099/? D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0092
01-24 18:40:09.837 6099-6099/? I/dalvikvm﹕ Failed resolving Lnet/rymate/notes/storage/GoogleDriveStorage; interface 1582 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
01-24 18:40:09.838 6099-6099/? W/dalvikvm﹕ Link of class 'Lnet/rymate/notes/storage/GoogleDriveStorage;' failed
01-24 18:40:09.839 6099-6099/? D/dalvikvm﹕ DexOpt: unable to opt direct call 0x3162 at 0x94 in Lnet/rymate/notes/activities/NotesListActivity;.onCreate
01-24 18:40:09.905 1038-8218/? D/dalvikvm﹕ GC_EXPLICIT freed 1503K, 23% free 26687K/34552K, paused 4ms+10ms, total 111ms
01-24 18:40:09.910 6099-6099/? D/AndroidRuntime﹕ Shutting down VM
01-24 18:40:09.910 6099-6099/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41616d40)
01-24 18:40:09.912 6099-6099/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: net.rymate.notes, PID: 6099
java.lang.NoClassDefFoundError: net.rymate.notes.storage.GoogleDriveStorage
at net.rymate.notes.activities.NotesListActivity.onCreate(NotesListActivity.java:122)
at android.app.Activity.performCreate(Activity.java:5248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5102)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126)
at dalvik.system.NativeStart.main(Native Method)
This is the source for the problem class (my main activity just creates a new instance of this class, it doesn't do anything with it):
package net.rymate.notes.storage;
import android.app.Activity;
import android.content.IntentSender.SendIntentException;
import android.os.Bundle;
import android.util.Log;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
import com.google.android.gms.drive.Drive;
/**
* Created by Ryan on 24/01/14.
*/
public class GoogleDriveStorage implements
ConnectionCallbacks,
OnConnectionFailedListener {
private static final String TAG = "GoogleDriveStorage";
/**
* Extra for account name.
*/
protected static final String EXTRA_ACCOUNT_NAME = "account_name";
/**
* Request code for auto Google Play Services error resolution.
*/
protected static final int REQUEST_CODE_RESOLUTION = 1;
/**
* Next available request code.
*/
protected static final int NEXT_AVAILABLE_REQUEST_CODE = 2;
private final Activity activity;
/**
* Google API client.
*/
private GoogleApiClient mGoogleApiClient;
public GoogleDriveStorage(Activity a) {
if (mGoogleApiClient == null) {
mGoogleApiClient = new GoogleApiClient.Builder(a.getApplication())
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
}
mGoogleApiClient.connect();
this.activity = a;
}
/**
* Called when {#code mGoogleApiClient} is connected.
*/
#Override
public void onConnected(Bundle connectionHint) {
Log.i(TAG, "GoogleApiClient connected");
}
/**
* Called when {#code mGoogleApiClient} is disconnected.
*/
#Override
public void onDisconnected() {
Log.i(TAG, "GoogleApiClient disconnected");
}
#Override
public void onConnectionFailed(ConnectionResult result) {
Log.i(TAG, "GoogleApiClient connection failed: " + result.toString());
if (!result.hasResolution()) {
// show the localized error dialog.
GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), activity, 0).show();
return;
}
try {
result.startResolutionForResult(activity, REQUEST_CODE_RESOLUTION);
} catch (SendIntentException e) {
Log.e(TAG, "Exception while starting resolution activity", e);
}
}
}
And my build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
mavenLocal()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
}
dependencies {
compile project(':libs:ShowcaseView')
// Google Play Services
compile 'com.google.android.gms:play-services:4.1.32'
}
Help will be appreciated!
EDIT: adding manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.rymate.notes"
android:versionCode="7"
android:versionName="1.3" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" android:hardwareAccelerated="true">
<activity android:name="net.rymate.notes.activities.NotesListActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="net.rymate.notes.activities.NoteViewActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="net.rymate.notes.activities.NoteEditActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:windowSoftInputMode="stateVisible|adjustResize" />
</application>
</manifest>
In the project properties under Java Build Path -> Order and Export make sure that "Android Private Libraries" and "Android Dependencies" are checked. Then clean and try again.

android application error 5

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

error- dalvik.system.PathClassLoader [data/app/com.my.appname-2.apk]

I searched a lot for similar kind of error, but I am not getting a solution for it. I am getting this error as soon as I start the app
03-21 10:33:08.100: E/AndroidRuntime(13098): FATAL EXCEPTION: main
03-21 10:33:08.100: E/AndroidRuntime(13098): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.airlife/com.example.airlife.MainActivity}: java.lang.ClassNotFoundException: com.example.airlife.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.airlife-2.apk]
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1785)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1893)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.ActivityThread.access$1500(ActivityThread.java:135)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.os.Handler.dispatchMessage(Handler.java:99)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.os.Looper.loop(Looper.java:150)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.ActivityThread.main(ActivityThread.java:4389)
03-21 10:33:08.100: E/AndroidRuntime(13098): at java.lang.reflect.Method.invokeNative(Native Method)
03-21 10:33:08.100: E/AndroidRuntime(13098): at java.lang.reflect.Method.invoke(Method.java:507)
03-21 10:33:08.100: E/AndroidRuntime(13098): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
03-21 10:33:08.100: E/AndroidRuntime(13098): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
03-21 10:33:08.100: E/AndroidRuntime(13098): at dalvik.system.NativeStart.main(Native Method)
03-21 10:33:08.100: E/AndroidRuntime(13098): Caused by: java.lang.ClassNotFoundException: com.example.airlife.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.airlife-2.apk]
03-21 10:33:08.100: E/AndroidRuntime(13098): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
03-21 10:33:08.100: E/AndroidRuntime(13098): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
03-21 10:33:08.100: E/AndroidRuntime(13098): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.Instrumentation.newActivity(Instrumentation.java:1040)
03-21 10:33:08.100: E/AndroidRuntime(13098): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1777)
03-21 10:33:08.100: E/AndroidRuntime(13098): ... 11 more
MainActivity.java is like this
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import android.os.Bundle;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
public class MainActivity extends MapActivity implements OnClickListener{
private ImageButton mVid,mAgebtn,mWeightbtn,mPicbtn,mMsgbtn,mReqbtn,mHelibtn,mDocbtn,mContextbtn;
private MapView mapView;
private MyLocationOverlay myLocationOverlay;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapView = (MapView)findViewById(R.id.webview);
mapView.setBuiltInZoomControls(true);
myLocationOverlay = new MyLocationOverlay(this, mapView);
mapView.getOverlays().add(myLocationOverlay);
mapView.postInvalidate();
// call convenience method that zooms map on our location
zoomToMyLocation();
mAgebtn = (ImageButton) findViewById(R.id.imageView36);
mWeightbtn = (ImageButton) findViewById(R.id.imageView4);
mPicbtn = (ImageButton) findViewById(R.id.imageView5);
mMsgbtn = (ImageButton) findViewById(R.id.imageView6);
mReqbtn = (ImageButton) findViewById(R.id.imageView32);
mHelibtn = (ImageButton) findViewById(R.id.btnsearch);
mDocbtn = (ImageButton) findViewById(R.id.btnprovide);
mVid = (ImageButton) findViewById(R.id.btnpost);
mContextbtn = (ImageButton) findViewById(R.id.btnsettings);
mAgebtn.setOnClickListener(this);
mWeightbtn.setOnClickListener(this);
mPicbtn.setOnClickListener(this);
mMsgbtn.setOnClickListener(this);
mReqbtn.setOnClickListener(this);
mHelibtn.setOnClickListener(this);
mDocbtn.setOnClickListener(this);
mVid.setOnClickListener(this);
mContextbtn.setOnClickListener(this);
}
#Override
protected void onResume() {
super.onResume();
// when our activity resumes, we want to register for location updates
myLocationOverlay.enableMyLocation();
}
#Override
protected void onPause() {
super.onPause();
// when our activity pauses, we want to remove listening for location updates
myLocationOverlay.disableMyLocation();
}
/**
* This method zooms to the user's location with a zoom level of 10.
*/
private void zoomToMyLocation() {
GeoPoint myLocationGeoPoint = myLocationOverlay.getMyLocation();
if(myLocationGeoPoint != null) {
mapView.getController().animateTo(myLocationGeoPoint);
mapView.getController().setZoom(10);
}
else {
Toast.makeText(this, "Cannot determine location", Toast.LENGTH_SHORT).show();
}
}
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
#Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.airlife"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.airlife.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".playvid" />
<activity android:name=".Display" />
<activity android:name=".Video" />
<activity android:name=".Documents" />
<activity android:name=".Contact" />
<activity android:name=".FixedMyLocationOverlay" />
</application>
</manifest>
Please tell me why I am getting this error, and how to solve this.
Got the solution. I had missed this code in my manifest file
<uses-library android:name="com.google.android.maps"/>
Class not found exception in MainActivity.
I think you've the wrong package, or that your APK doesn't have what you think it has.This is your package name.
com.example.airlife
Maku sure that it is imported in all activities as.
package com.example.airlife;
and don't forget to add entry in manifest file for every new activity.
If so, then make this change in manifest file. No need to mention your package name and remove allowBackUp
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
if not this try adding any library files you are using. missing library files may also cause this exception. see this link
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo after SDK update

Unable to instantiate activity componentInfo, Activity declared in Manifest

I was adding the Google Cloud Messaging service to my App and altered my manifest file. I get the following StackTrace.
02-27 18:58:11.282: E/AndroidRuntime(988): FATAL EXCEPTION: main
02-27 18:58:11.282: E/AndroidRuntime(988): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.phptest/com.example.phptest.MainActivity}: java.lang.ClassNotFoundException: com.example.phptest.MainActivity
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.access$600(ActivityThread.java:130)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.os.Handler.dispatchMessage(Handler.java:99)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.os.Looper.loop(Looper.java:137)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.main(ActivityThread.java:4745)
02-27 18:58:11.282: E/AndroidRuntime(988): at java.lang.reflect.Method.invokeNative(Native Method)
02-27 18:58:11.282: E/AndroidRuntime(988): at java.lang.reflect.Method.invoke(Method.java:511)
02-27 18:58:11.282: E/AndroidRuntime(988): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
02-27 18:58:11.282: E/AndroidRuntime(988): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-27 18:58:11.282: E/AndroidRuntime(988): at dalvik.system.NativeStart.main(Native Method)
02-27 18:58:11.282: E/AndroidRuntime(988): Caused by: java.lang.ClassNotFoundException: com.example.phptest.MainActivity
02-27 18:58:11.282: E/AndroidRuntime(988): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
02-27 18:58:11.282: E/AndroidRuntime(988): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
02-27 18:58:11.282: E/AndroidRuntime(988): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
02-27 18:58:11.282: E/AndroidRuntime(988): ... 11 more
Here is my Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.phptest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="16" />
<uses-configuration />
<permission
android:name="com.example.phptest.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.phptest.permission.C2D_MESSAGE" />
<!-- App receives GCM messages. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.phptest.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".GCMIntentService" />
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.example.phptest" />
</intent-filter>
</receiver>
</application>
</manifest>
MainActivity:
package com.example.phptest;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import com.example.phptest.DeviceLogin.LoginReply;
import com.google.android.gcm.GCMRegistrar;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
public class MainActivity extends Activity implements LoginReply {
String TAG = "Main Activity";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DeviceLogin d = new DeviceLogin(this);
d.execute("xxxx","12345");
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, GCMIntentService.senderId);
} else {
Log.v(TAG, "Already registered");
}
}
#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_main, menu);
return true;
}
public static String makeCall(String scriptName) {
String address = "http://10.0.2.2/" + scriptName + ".php";
HttpPost httpPost = new HttpPost(address);
HttpClient httpClient = new DefaultHttpClient();
StringBuilder total = new StringBuilder();
try {
//httpPost.setEntity(new UrlEncodedFormEntity(params));
// Execute HTTP Post Request
HttpResponse response = httpClient.execute(httpPost);
InputStream is = response.getEntity().getContent();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line = "";
// Read response until the end
while ((line = rd.readLine()) != null) {
total.append(line);
}
// Return full string
System.out.println("TOTAL: " + total.toString());
return total.toString();
} catch (Exception e) {
e.printStackTrace();
}
return "empty";
}
public void onDevicesDownloaded(String login) {
// TODO Auto-generated method stub
}
}
Any ideas?
I have seen Android apps get finicky when the full path is specified in the name attribute unless the package the class is in differs from the one you specify at the top of the manifest file. Try changing it to just ".MainActivity" and see if that makes it happy.
Solution was to clean project, D'oh! xD

Unfortunately, App has stopped (Android Development)

I just started android development in 2 days and this is the error that I cannot solve "Unfortunately, [App] has stopped".
This is what I'm planning to do with the APP.
show the UI that will tell the user that by pressing ok the app will start making a log file.
when the OK button is pressed, it will run in the background (don't need UI) and will wait for the notification from other app and will write the text from the notification to the log file.
This is my AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.notificationnotifier"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.notificationnotifier.GetNotification"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.notificationnotifier.MonitorNotification"
android:label="#string/app_name" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
This is GetNotification.java
public class GetNotification extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_get_notification);
Button okButton = (Button) findViewById(R.id.OKButton);
okButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent getNotification = new Intent("com.example.notificationnotifier.MonitorNotification");
startActivity(getNotification);
}
}) ;
Button cancel = (Button) findViewById(R.id.Cancel);
cancel.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
finish();
}
}) ;
}
#Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
}
#Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
#Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
}
#Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
}
}
This is MonitorNotification.java
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.view.accessibility.AccessibilityEvent;
public class MonitorNotification extends AccessibilityService{
#Override
public void onAccessibilityEvent(AccessibilityEvent arg0) {
// TODO Auto-generated method stub
}
#Override
public void onInterrupt() {
// TODO Auto-generated method stub
}
#Override
protected void onServiceConnected() {
// TODO Auto-generated method stub
// super.onServiceConnected();
AccessibilityServiceInfo info = new AccessibilityServiceInfo();
info.feedbackType = 1;
info.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
info.notificationTimeout = 100;
setServiceInfo(info);
}
}
This is the logcat
[updated]
02-04 10:31:17.947: E/Trace(1108): error opening trace file: No such file or directory (2)
02-04 10:31:18.648: D/gralloc_goldfish(1108): Emulator without GPU emulation detected.
02-04 10:31:21.128: D/AndroidRuntime(1108): Shutting down VM
02-04 10:31:21.148: W/dalvikvm(1108): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
02-04 10:31:21.169: E/AndroidRuntime(1108): FATAL EXCEPTION: main
02-04 10:31:21.169: E/AndroidRuntime(1108): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.notificationnotifier/com.example.notificationnotifier.MonitorNotification}: java.lang.ClassCastException: com.example.notificationnotifier.MonitorNotification cannot be cast to android.app.Activity
02-04 10:31:21.169: E/AndroidRuntime(1108): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
02-04 10:31:21.169: E/AndroidRuntime(1108): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
02-04 10:31:21.169: E/AndroidRuntime(1108): at android.app.ActivityThread.access$600(ActivityThread.java:130)
02-04 10:31:21.169: E/AndroidRuntime(1108): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
02-04 10:31:21.169: E/AndroidRuntime(1108): at android.os.Handler.dispatchMessage(Handler.java:99)
02-04 10:31:21.169: E/AndroidRuntime(1108): at android.os.Looper.loop(Looper.java:137)
02-04 10:31:21.169: E/AndroidRuntime(1108): at android.app.ActivityThread.main(ActivityThread.java:4745)
02-04 10:31:21.169: E/AndroidRuntime(1108): at java.lang.reflect.Method.invokeNative(Native Method)
02-04 10:31:21.169: E/AndroidRuntime(1108): at java.lang.reflect.Method.invoke(Method.java:511)
02-04 10:31:21.169: E/AndroidRuntime(1108): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
02-04 10:31:21.169: E/AndroidRuntime(1108): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-04 10:31:21.169: E/AndroidRuntime(1108): at dalvik.system.NativeStart.main(Native Method)
02-04 10:31:21.169: E/AndroidRuntime(1108): Caused by: java.lang.ClassCastException: com.example.notificationnotifier.MonitorNotification cannot be cast to android.app.Activity
02-04 10:31:21.169: E/AndroidRuntime(1108): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
02-04 10:31:21.169: E/AndroidRuntime(1108): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
02-04 10:31:21.169: E/AndroidRuntime(1108): ... 11 more
02-04 10:31:23.268: I/Process(1108): Sending signal. PID: 1108 SIG: 9
Replace this line:
Intent getNotification = new Intent("com.example.notificationnotifier.MonitorNotification");
by this one:
Intent getNotification = new Intent(GetNotification.this,
MonitorNotification.class);
Hope it helps.
Add the below code in your manifest file:
<service android:name=".MyAccessibilityService"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
. . .
</service>
Declaration
An accessibility is declared as any other service in an AndroidManifest.xml but it must also specify that it handles the "android.accessibilityservice.AccessibilityService" Intent. Failure to declare this intent will cause the system to ignore the accessibility service. Additionally an accessibility service must request the BIND_ACCESSIBILITY_SERVICE permission to ensure that only the system can bind to it. Failure to declare this intent will cause the system to ignore the accessibility service. Following is an example declaration:
<service android:name=".MyAccessibilityService"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
. . .
</service>
I know now what the problem was, my friend told me that it should be startService not startActivity in the getNotification.java
the correct way to call it is
startService(getNotification);
not
startActivity(getNotification);
I'm extending AccesibilityService in the class in MonitorNotification.java. :D

Categories