04-25 14:16:30.931: E/AndroidRuntime(6638): FATAL EXCEPTION: main
04-25 14:16:30.931: E/AndroidRuntime(6638): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {com.exclusive26.igale/com.exclusive26.igale.Push_Activity}: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gsf (has extras) } without permission com.google.android.c2dm.permission.RECEIVE
04-25 14:16:30.931: E/AndroidRuntime(6638): at android.app.ActivityThread.deliverResults(ActivityThread.java:2553)
04-25 14:16:30.931: E/AndroidRuntime(6638): at android.app.ActivityThread.handleSendResult(ActivityThread.java:2595)
04-25 14:16:30.931: E/AndroidRuntime(6638): at android.app.ActivityThread.access$2000(ActivityThread.java:121)
04-25 14:16:30.931: E/AndroidRuntime(6638): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:973)
04-25 14:16:30.931: E/AndroidRuntime(6638): at android.os.Handler.dispatchMessage(Handler.java:99)
04-25 14:16:30.931: E/AndroidRuntime(6638): at android.os.Looper.loop(Looper.java:130)
04-25 14:16:30.931: E/AndroidRuntime(6638): at android.app.ActivityThread.main(ActivityThread.java:3701)
04-25 14:16:30.931: E/AndroidRuntime(6638): at java.lang.reflect.Method.invokeNative(Native Method)
04-25 14:16:30.931: E/AndroidRuntime(6638): at java.lang.reflect.Method.invoke(Method.java:507)
04-25 14:16:30.931: E/AndroidRuntime(6638): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
04-25 14:16:30.931: E/AndroidRuntime(6638): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
04-25 14:16:30.931: E/AndroidRuntime(6638): at dalvik.system.NativeStart.main(Native Method)
04-25 14:16:30.931: E/AndroidRuntime(6638): Caused by: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gsf (has extras) } without permission com.google.android.c2dm.permission.RECEIVE
04-25 14:16:30.931: E/AndroidRuntime(6638): at android.app.ContextImpl.startService(ContextImpl.java:867)
04-25 14:16:30.931: E/AndroidRuntime(6638): at android.content.ContextWrapper.startService(ContextWrapper.java:336)
04-25 14:16:30.931: E/AndroidRuntime(6638): at com.google.android.c2dm.C2DMessaging.register(C2DMessaging.java:54)
04-25 14:16:30.931: E/AndroidRuntime(6638): at com.exclusive26.igale.Push_Activity.register(Push_Activity.java:124)
04-25 14:16:30.931: E/AndroidRuntime(6638): at com.exclusive26.igale.Push_Activity.onActivityResult(Push_Activity.java:58)
04-25 14:16:30.931: E/AndroidRuntime(6638): at android.app.Activity.dispatchActivityResult(Activity.java:3908)
04-25 14:16:30.931: E/AndroidRuntime(6638): at android.app.ActivityThread.deliverResults(ActivityThread.java:2549)
04-25 14:16:30.931: E/AndroidRuntime(6638): ... 11 more
The intent does have the proper permission in manifest:
MANIFEST:
<permission
android:name="com.exclusive26.igale.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.exclusive26.igale.permission.C2D_MESSAGE"/>
<uses-permission android:name="com.exclusive26.igale.c2dm.permission.RECEIVE"/>
...
...
<activity android:name=".Push_Activity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
...
...
<service android:name=".C2DMReceiver" />
<receiver android:name="com.google.android.c2dm.C2DMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.exclusive26.igale" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
<category android:name="com.exclusive26.igale" />
</intent-filter>
</receiver>
chk out the following code in Push_Activity.java :
com.google.android.c2dm.C2DMessaging.register( this, com.exclusive26.igale.Config.C2DM_SENDER );
parameters sent correctly (Push_Activity context and some email address <-- static final String)
inside C2DMessaging.register :
public static void register(Context context,
String senderId) {
Intent registrationIntent = new Intent(REQUEST_REGISTRATION_INTENT);
registrationIntent.setPackage(GSF_PACKAGE);
registrationIntent.putExtra(EXTRA_APPLICATION_PENDING_INTENT,
PendingIntent.getBroadcast(context, 0, new Intent(), 0));
registrationIntent.putExtra(EXTRA_SENDER, senderId);
context.startService(registrationIntent);
// TODO: if intent not found, notification on need to have GSF
}
in the startService() i get the exception. No idia how to solve this.
please shed some light on the subject. Many Thanx!
Just for future users with this error:
manifest file should look like this:
<permission
android:name="YOUR_PACKAGE.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="YOUR_PACKAGE.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
instead of
<permission
android:name="YOUR_PACKAGE.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="YOUR_PACKAGE.permission.C2D_MESSAGE" />
<uses-permission android:name="YOUR_PACKAGE.permission.RECEIVE" />
I spend about 5 hours to found out what was wrong in my project :)
Maybe I'm missing something but the error shows "com.google.android.c2dm.permission.RECEIVE" and the manifest contains "com.google.android.c2dm.permission.SEND" so I don't see a perfect match.
The code was correct. I created a new project, copied the code and no problem anymore
This error also can be provide, if we use some resource's names incorrectly in our Activity Java file. I also got the same error, but I did not use any services or permission yet. Problem was at onCreate() method with wrong resource id.
Related
I'm an android newbie. I'm using android studio, device 4.0.4, api 14. When I run on device, I get the error message. It looks like google play services are missing on the device. I can see google play store on the device. I also activated using my gmail account. Device is not setup with verizon. Any help on what I'm missing?
09-23 10:16:44.642 19251-19251/com.noatta.www.noatta_14 D/dalvikvm﹕ Late-enabling CheckJNI
09-23 10:16:45.263 19251-19251/com.noatta.www.noatta_14 W/SignInButton﹕ Sign in button not found, using placeholder instead
09-23 10:16:45.533 19251-19251/com.noatta.www.noatta_14 W/GooglePlayServicesUtil﹕ Google Play services is missing.
09-23 10:16:45.543 19251-19251/com.noatta.www.noatta_14 W/GooglePlayServicesUtil﹕ Google Play services is missing.
09-23 10:16:45.823 19251-19251/com.noatta.www.noatta_14 D/AndroidRuntime﹕ Shutting down VM
09-23 10:16:45.823 19251-19251/com.noatta.www.noatta_14 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40ab0228)
09-23 10:16:45.823 19251-19251/com.noatta.www.noatta_14 E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NullPointerException
at com.noatta.www.noatta_14.LoginActivity.updateConnectButtonState(LoginActivity.java:250)
at com.noatta.www.noatta_14.PlusBaseActivity.onConnectionFailed(PlusBaseActivity.java:264)
at com.google.android.gms.internal.id$g.onConnectionFailed(Unknown Source)
at com.google.android.gms.internal.ie.a(Unknown Source)
at com.google.android.gms.internal.id$a.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4945)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ killProcess, pid=19251
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ dalvik.system.VMStack.getThreadStackTrace(Native Method)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ java.lang.Thread.getStackTrace(Thread.java:599)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ android.os.Process.killProcess(Process.java:788)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:104)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ dalvik.system.NativeStart.main(Native Method)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 I/Process﹕ Sending signal. PID: 19251 SIG: 9
Manifest
<code>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.noatta.www.noatta_14" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".LoginActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize|stateHidden"
android:exported="true">
<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" />
</application>
<!-- To access Google+ APIs: -->
<uses-permission android:name="android.permission.INTERNET" />
<!--
To retrieve OAuth 2.0 tokens or invalidate tokens to disconnect a user. This disconnect
option is required to comply with the Google+ Sign-In developer policies
-->
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<!-- To retrieve the account name (email) as part of sign-in: -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
You are missing this: https://play.google.com/store/apps/details?id=com.google.android.gms
Google Play Services != Google Play Store.
I've followed google guide about new GCM with Google Play Services and after hours of developing i managed to register my device on GCM server, to obtain the REGISTER_ID and to create a php script which correctly send a post request.
The bad news is that i don't manage to receive my push notification, when i run my app logcat shows this error:
12-19 19:48:24.405: E/AndroidRuntime(9570): FATAL EXCEPTION: main
12-19 19:48:24.405: E/AndroidRuntime(9570): java.lang.RuntimeException: Unable to instantiate receiver com.baruckis.SlidingMenuImplementation.GcmBroadcastReceiver:
java.lang.ClassNotFoundException: com.baruckis.SlidingMenuImplementation.GcmBroadcastReceiver
12-19 19:48:24.405: E/AndroidRuntime(9570): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2112)
12-19 19:48:24.405: E/AndroidRuntime(9570): at android.app.ActivityThread.access$1500(ActivityThread.java:127)
12-19 19:48:24.405: E/AndroidRuntime(9570): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
12-19 19:48:24.405: E/AndroidRuntime(9570): at android.os.Handler.dispatchMessage(Handler.java:99)
12-19 19:48:24.405: E/AndroidRuntime(9570): at android.os.Looper.loop(Looper.java:137)
12-19 19:48:24.405: E/AndroidRuntime(9570): at android.app.ActivityThread.main(ActivityThread.java:4507)
12-19 19:48:24.405: E/AndroidRuntime(9570): at java.lang.reflect.Method.invokeNative(Native Method)
12-19 19:48:24.405: E/AndroidRuntime(9570): at java.lang.reflect.Method.invoke(Method.java:511)
12-19 19:48:24.405: E/AndroidRuntime(9570): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
12-19 19:48:24.405: E/AndroidRuntime(9570): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
12-19 19:48:24.405: E/AndroidRuntime(9570): at dalvik.system.NativeStart.main(Native Method)
12-19 19:48:24.405: E/AndroidRuntime(9570): Caused by: java.lang.ClassNotFoundException: com.baruckis.SlidingMenuImplementation.GcmBroadcastReceiver
12-19 19:48:24.405: E/AndroidRuntime(9570): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
12-19 19:48:24.405: E/AndroidRuntime(9570): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-19 19:48:24.405: E/AndroidRuntime(9570): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-19 19:48:24.405: E/AndroidRuntime(9570): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2107)
12-19 19:48:24.405: E/AndroidRuntime(9570): ... 10 more
12-19 19:48:52.620: I/Process(9570): Sending signal. PID: 9570 SIG: 9
This is my Manifest (i've omitted the unnecessary parts of code):
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17"
/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission android:name="com.baruckis.SlidingMenuImplementation.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.baruckis.SlidingMenuImplementation.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive data message. -->
<uses-permission
android:name="com.google.android.c2dm.permission.RECEIVE" />
<application
[...]
<receiver
android:name="com.baruckis.SlidingMenuImplementation.GcmBroadcastReceiver"
android:enabled="true"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.baruckis.SlidingMenuImplementation" />
</intent-filter>
</receiver>
<service android:name="com.baruckis.SlidingMenuImplementation.GcmIntentService" />
<meta-data android:name="com.google.android.gms.version" android:value="4030500" />
</application>
And finally this is my GcmBroadcastReceiver code:
package com.baruckis.SlidingMenuImplementation;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.support.v4.content.WakefulBroadcastReceiver;
public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
// Explicitly specify that GcmIntentService will handle the intent.
ComponentName comp = new ComponentName(context.getPackageName(),
GcmIntentService.class.getName());
// Start the service, keeping the device awake while it is launching.
startWakefulService(context, (intent.setComponent(comp)));
setResultCode(Activity.RESULT_OK);
}
}
Thanks to all! :)
Try extending the provided: com.google.android.gcm.GCMBroadcastReceiver
public class MyGCMBroadcastReceiver extends com.google.android.gcm.GCMBroadcastReceiver {
protected String getGCMIntentServiceClassName(Context context) {
return GCMIntentService.class.getName();
}
}
Hey this is the weirdest problem i've ever encoutered,
I have 2 projects that's exactly the same each in a different project with a different package name.
Now i'm trying to run the 2nd project and i get a NullPointerException and when i press the error for it to send me to the line of code, it loads the same activity but in a different project.
Any idea why that happens?
This is my manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="shibby.koteret"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.CAMERA"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen" >
<activity
android:name=".TenKoteretActivity"
android:label="#string/app_name"
android:configChanges="keyboardHidden|orientation"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="#string/chosen_image" android:name="selectedImageActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
/>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
</manifest>
Which is exactly the same in both projects besides package name and main activity name.
This is the logcat :
06-26 21:02:38.324: E/AndroidRuntime(5237): FATAL EXCEPTION: main
06-26 21:02:38.324: E/AndroidRuntime(5237): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1886, result=-1, data=Intent { dat=content://media/external/images/media/45 }} to activity {shibby.koteret/shibby.koteret.selectedImageActivity}: java.lang.NullPointerException
06-26 21:02:38.324: E/AndroidRuntime(5237): at android.app.ActivityThread.deliverResults(ActivityThread.java:2536)
06-26 21:02:38.324: E/AndroidRuntime(5237): at android.app.ActivityThread.handleSendResult(ActivityThread.java:2578)
06-26 21:02:38.324: E/AndroidRuntime(5237): at android.app.ActivityThread.access$2000(ActivityThread.java:117)
06-26 21:02:38.324: E/AndroidRuntime(5237): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:965)
06-26 21:02:38.324: E/AndroidRuntime(5237): at android.os.Handler.dispatchMessage(Handler.java:99)
06-26 21:02:38.324: E/AndroidRuntime(5237): at android.os.Looper.loop(Looper.java:123)
06-26 21:02:38.324: E/AndroidRuntime(5237): at android.app.ActivityThread.main(ActivityThread.java:3687)
06-26 21:02:38.324: E/AndroidRuntime(5237): at java.lang.reflect.Method.invokeNative(Native Method)
06-26 21:02:38.324: E/AndroidRuntime(5237): at java.lang.reflect.Method.invoke(Method.java:507)
06-26 21:02:38.324: E/AndroidRuntime(5237): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
06-26 21:02:38.324: E/AndroidRuntime(5237): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
06-26 21:02:38.324: E/AndroidRuntime(5237): at dalvik.system.NativeStart.main(Native Method)
06-26 21:02:38.324: E/AndroidRuntime(5237): Caused by: java.lang.NullPointerException
06-26 21:02:38.324: E/AndroidRuntime(5237): at shibby.koteret.selectedImageActivity.onActivityResult(selectedImageActivity.java:196)
06-26 21:02:38.324: E/AndroidRuntime(5237): at android.app.Activity.dispatchActivityResult(Activity.java:3908)
06-26 21:02:38.324: E/AndroidRuntime(5237): at android.app.ActivityThread.deliverResults(ActivityThread.java:2532)
06-26 21:02:38.324: E/AndroidRuntime(5237): ... 11 more
I don't think it's related, but as asked this is the relavent Java code (Errors on setContentView):
setContentView(R.layout.chosen_image);
ImageView imageView = (ImageView)this.findViewById(R.id.chosenImage2);
imageView.setImageBitmap(bitmap);
What i've checked :
The 2nd project packages the activity to the write project
I am not importing any thing from the 1st project package
Could this be an Eclipse error only? Anyone ever seen such a problem?
I was thinking, as the error is on an XML file, could it be somehow related to the R?
Well, what worked for me was i closed the 1st project and then Eclipse sent me to the right NullPointerException.
Still no idea why that happened, but that did the trick for me.
Code:
setContentView(R.layout.splashscreen);
Thread timer = new Thread() {
#Override
public void run() {
// TODO Auto-generated method stub
try {
sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
intent=new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.google.com/"));
startActivity(intent);
}
}
};
timer.start();
}
#Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
this.finish();
}
}
As you guys can see, this a very simple program which will show a splash screen and then will open the url in the browser. Everything is fine up to here. Now by using the back button I exit from the app. But as soon as I try to press the installed app icon, the system gives me a toast saying "app is not installed on your phone".
When I check the running services, its always there and my logcat says: "Launcher does not have permission to launch the intent".
So my 1st question: Why my app is running all the time, although I have called the finish() in the onPause() method?
Q2. What this logcat message indicates?
Here is my manifest (guess you're thinking that I haven't added the uses-permission for internet but I had):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abc.xyz.main"
android:versionCode="1"
android:versionName="1.0.1" >
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="#drawable/app_icon"
android:label="#string/app_name" android:permission="android.permission.INTERNET" android:description="#string/appdescription">
<activity
android:name=".SplashActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Here is the logcat:
04-29 23:17:56.745: I/ActivityManager(68): Starting activity: Intent {act=android.intent.action.MAIN cat[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.vayyoo.epost.main/.SplashActivity }
04-29 23:17:56.745: W/ActivityManager(68): Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.vayyoo.epost.main/.SplashActivity } from ProcessRecord{45cfc0f8 240:com.android.launcher/10025} (pid=240, uid=10025) requires android.permission.INTERNET
04-29 23:17:56.785: E/Launcher(240): Launcher does not have the permission to launch Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.vayyoo.epost.main/.SplashActivity }. Make sure to create a MAIN intent-filter for the corresponding activity or use the exported attribute for this activity. tag=ApplicationInfo(title=ePost) intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.vayyoo.epost.main/.SplashActivity }
04-29 23:17:56.785: E/Launcher(240): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.vayyoo.epost.main/.SplashActivity } from ProcessRecord{45cfc0f8 240:com.android.launcher/10025} (pid=240, uid=10025) requires android.permission.INTERNET
04-29 23:17:56.785: E/Launcher(240): at android.os.Parcel.readException(Parcel.java:1247)
04-29 23:17:56.785: E/Launcher(240): at android.os.Parcel.readException(Parcel.java:1235)
04-29 23:17:56.785: E/Launcher(240): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1298)
04-29 23:17:56.785: E/Launcher(240): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1373)
04-29 23:17:56.785: E/Launcher(240): at android.app.Activity.startActivityForResult(Activity.java:2817)
04-29 23:17:56.785: E/Launcher(240): at com.android.launcher2.Launcher.startActivityForResult(Launcher.java:1053)
04-29 23:17:56.785: E/Launcher(240): at android.app.Activity.startActivity(Activity.java:2923)
04-29 23:17:56.785: E/Launcher(240): at com.android.launcher2.Launcher.startActivitySafely(Launcher.java:1462)
04-29 23:17:56.785: E/Launcher(240): at com.android.launcher2.AllApps2D.onItemClick(AllApps2D.java:178)
04-29 23:17:56.785: E/Launcher(240): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
04-29 23:17:56.785: E/Launcher(240): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696)
04-29 23:17:56.785: E/Launcher(240): at android.os.Handler.handleCallback(Handler.java:587)
04-29 23:17:56.785: E/Launcher(240): at android.os.Handler.dispatchMessage(Handler.java:92)
04-29 23:17:56.785: E/Launcher(240): at android.os.Looper.loop(Looper.java:123)
04-29 23:17:56.785: E/Launcher(240): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 23:17:56.785: E/Launcher(240): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 23:17:56.785: E/Launcher(240): at java.lang.reflect.Method.invoke(Method.java:521)
04-29 23:17:56.785: E/Launcher(240): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-29 23:17:56.785: E/Launcher(240): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-29 23:17:56.785: E/Launcher(240): at dalvik.system.NativeStart.main(Native Method)
04-29 23:17:59.855: W/KeyCharacterMap(240): No keyboard for id 0
04-29 23:17:59.855: W/KeyCharacterMap(240): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
If you are using Ice Cream Sandwich,(I remember reading this somewhere in SO) not only does the permission have to be in its own tag the application cannot have the attribute "android.permission.INTERNET" at the same time.. so just remove this from application node and try...
Try removing the:
android:permission="android.permission.INTERNET"
From this part:
<application
android:icon="#drawable/app_icon"
android:label="#string/app_name" android:permission="android.permission.INTERNET" android:description="#string/appdescription">
But leave it in the other part of your manifest.
I am trying to write an app that starts on boot up. My receiver works and my app is started on boot up, however it crashes because of ActivityNotFoundException. I may have messed up in the manifest somewhere. Please help to take a look.
This is the receiver code, LocationLock.class just does some stuff to lock the phone.
public class MyStartupIntentReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent){
Intent myStarterIntent = new Intent(context, LocationLock.class);
myStarterIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myStarterIntent);
}
}
This is the manifest:
<?xml version="1.0" encoding="utf-8"?>
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".LocationLock$Controller"
android:label="#string/app_name_controller">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".LocationLock"
android:label="#string/app_name"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data android:name="android.app.device_admin"
android:resource="#xml/device_admin" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>
<receiver android:name=".MyStartupIntentReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</manifest>
Below are the errors:
05-03 02:54:55.301: ERROR/AndroidRuntime(264): FATAL EXCEPTION: main
05-03 02:54:55.301: ERROR/AndroidRuntime(264): java.lang.RuntimeException: Unable to start receiver org.example.locationlock.MyStartupIntentReceiver: android.content.ActivityNotFoundException: Unable to find explicit activity class {org.example.locationlock/org.example.locationlock.LocationLock}; have you declared this activity in your AndroidManifest.xml?
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2821)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at android.app.ActivityThread.access$3200(ActivityThread.java:125)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2083)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at android.os.Handler.dispatchMessage(Handler.java:99)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at android.os.Looper.loop(Looper.java:123)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at java.lang.reflect.Method.invokeNative(Native Method)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at java.lang.reflect.Method.invoke(Method.java:521)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at dalvik.system.NativeStart.main(Native Method)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {org.example.locationlock/org.example.locationlock.LocationLock}; have you declared this activity in your AndroidManifest.xml?
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at android.app.ContextImpl.startActivity(ContextImpl.java:622)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at android.content.ContextWrapper.startActivity(ContextWrapper.java:258)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at android.content.ContextWrapper.startActivity(ContextWrapper.java:258)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at org.example.locationlock.MyStartupIntentReceiver.onReceive(MyStartupIntentReceiver.java:12)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2810)
05-03 02:54:55.301: ERROR/AndroidRuntime(264): ... 10 more
Maybe I can't have two receivers listed one after another, but the MyStartupIntentReceiver has no activity associated with it.
Any help is much appreciated!
you are trying to start a receiver class: Intent myStarterIntent = new Intent(context, LocationLock.class);, since in the manifest file it is declared as a reciever class: <receiver android:name=".LocationLock" so modify this declaration to activiy:
<activity
android:name=".LocationLock"
android:windowSoftInputMode="stateVisible|adjustResize" >
</activity>
have you tried defining it as an activity in your manifest?
for example, within your section:
<activity android:name=".MyStartupIntentReceiver"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:noHistory="true" />