Launch Error on Android Application - android

I keep getting this error:
12-02 17:34:55.648: E/AndroidRuntime(426): java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
12-02 17:34:55.648: E/AndroidRuntime(426): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:147)
12-02 17:34:55.648: E/AndroidRuntime(426): at android.support.v7.app.ActionBarActivityDelegateBase.onCreate(ActionBarActivityDelegateBase.java:138)
12-02 17:34:55.648: E/AndroidRuntime(426): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:123)
I have tried unimporting and reimporting android.support.v7.ActionBarActivity
I hope someone can guide me to what the error is

Related

java.lang.ClassNotFoundException crash report

I got this crash report from many users.
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.*appname*/com.unity3d.player.UnityPlayerActivity}: java.lang.ClassNotFoundException: Didn't find class "com.unity3d.player.UnityPlayerActivity" on path: /mnt/asec/com.*appname*-1/pkg.apk
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2229)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2359)
at android.app.ActivityThread.access$700(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5455)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1209)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1025)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.unity3d.player.UnityPlayerActivity" on path: /mnt/asec/com.*appname*-1/pkg.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2220)
... 11 more
Anyone have any idea what to do?
Never used unity3d... also I don't know what's in your gradle files, so can't really say unless you give more information. However, you could try cleaning your project and rebuilding it. Go to Build -> Clean Project or use gradlew clean if you are comfortable with the command line.

android random exception when resuming Unable to start activity ComponentInfo android.content.res.Resources$NotFoundException

I have quite strange exception which appears when my app is resumed (after I switch to other apps and then return to mine) although it's not thrown always but only from time to time.
The part where exception is quite simple. I use ViewPager (v4) and have two dialog classes, first child DialogHelp:
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState); [line 50]
second the parent PMDialogFragment (extends DialogFragment):
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
app = (PMApplication) getActivity().getApplication();
View view = inflater.inflate(layoutId, container); [line 50]
and below logcat:
12-02 00:48:04.532: E/AndroidRuntime(22292): FATAL EXCEPTION: main
12-02 00:48:04.532: E/AndroidRuntime(22292): java.lang.RuntimeException: Unable to start activity ComponentInfo{pitersoft.pitermemoflashcards/pitermemo.android.gui.activities.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1964)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1989)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.app.ActivityThread.access$600(ActivityThread.java:126)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1155)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.os.Handler.dispatchMessage(Handler.java:99)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.os.Looper.loop(Looper.java:137)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.app.ActivityThread.main(ActivityThread.java:4482)
12-02 00:48:04.532: E/AndroidRuntime(22292): at java.lang.reflect.Method.invokeNative(Native Method)
12-02 00:48:04.532: E/AndroidRuntime(22292): at java.lang.reflect.Method.invoke(Method.java:511)
12-02 00:48:04.532: E/AndroidRuntime(22292): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
12-02 00:48:04.532: E/AndroidRuntime(22292): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
12-02 00:48:04.532: E/AndroidRuntime(22292): at dalvik.system.NativeStart.main(Native Method)
12-02 00:48:04.532: E/AndroidRuntime(22292): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.content.res.Resources.getValue(Resources.java:1041)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2191)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.content.res.Resources.getLayout(Resources.java:880)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-02 00:48:04.532: E/AndroidRuntime(22292): at pitermemo.android.gui.dialogs.PMDialogFragment.onCreateView(PMDialogFragment.java:50)
12-02 00:48:04.532: E/AndroidRuntime(22292): at pitermemo.android.gui.dialogs.DialogHelp.onCreateView(DialogHelp.java:50)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1877)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:552)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1133)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.app.Activity.performStart(Activity.java:4475)
12-02 00:48:04.532: E/AndroidRuntime(22292): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1937)
12-02 00:48:04.532: E/AndroidRuntime(22292): ... 11 more
I really don't know what causes that and how to solve this. If it was repeated always, it would be much easier.
I'm thinking perhaps it's somehow related with WebView component which likes to make problems. Another suspicious thing is in onResume of main app I run sometimes AsyncTask. But the log doesn't suggest this.
Do you have any suggestions what can cause this? Thanks in advance. (android min sdk 11, run on device with android 4.0.4).

the application myapp(process com.example.package) has stopped unexpectedly please try again

I had so many troubles with my android app. it can't run but now I could make it, unfortunately, I receive the error" the application myapp(process com.example.package) has stopped unexpectedly please try again)
here is my log file
12-02 11:25:11.980: E/MediaPlayer(278): Unable to to create media player
12-02 11:25:12.290: D/MediaPlayer(278): create failed:
12-02 11:25:12.290: D/MediaPlayer(278): java.io.IOException: setDataSourceFD failed.: status=0x80000000
12-02 11:25:12.290: D/MediaPlayer(278): at android.media.MediaPlayer.setDataSource(Native Method)
12-02 11:25:12.290: D/MediaPlayer(278): at android.media.MediaPlayer.create(MediaPlayer.java:645)
12-02 11:25:12.290: D/MediaPlayer(278): at com.mohammed.watzIslam.Mymain.onCreate(Mymain.java:27)
12-02 11:25:12.290: D/MediaPlayer(278): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-02 11:25:12.290: D/MediaPlayer(278): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-02 11:25:12.290: D/MediaPlayer(278): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-02 11:25:12.290: D/MediaPlayer(278): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-02 11:25:12.290: D/MediaPlayer(278): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-02 11:25:12.290: D/MediaPlayer(278): at android.os.Handler.dispatchMessage(Handler.java:99)
12-02 11:25:12.290: D/MediaPlayer(278): at android.os.Looper.loop(Looper.java:123)
12-02 11:25:12.290: D/MediaPlayer(278): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-02 11:25:12.290: D/MediaPlayer(278): at java.lang.reflect.Method.invokeNative(Native Method)
12-02 11:25:12.290: D/MediaPlayer(278): at java.lang.reflect.Method.invoke(Method.java:521)
12-02 11:25:12.290: D/MediaPlayer(278): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-02 11:25:12.290: D/MediaPlayer(278): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-02 11:25:12.290: D/MediaPlayer(278): at dalvik.system.NativeStart.main(Native Method)
12-02 11:25:12.290: D/AndroidRuntime(278): Shutting down VM
12-02 11:25:12.290: W/dalvikvm(278): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
12-02 11:25:12.300: E/AndroidRuntime(278): FATAL EXCEPTION: main
12-02 11:25:12.300: E/AndroidRuntime(278): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mohammed.watzIslam/com.mohammed.watzIslam.Mymain}: java.lang.NullPointerException
12-02 11:25:12.300: E/AndroidRuntime(278): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
12-02 11:25:12.300: E/AndroidRuntime(278): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-02 11:25:12.300: E/AndroidRuntime(278): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-02 11:25:12.300: E/AndroidRuntime(278): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-02 11:25:12.300: E/AndroidRuntime(278): at android.os.Handler.dispatchMessage(Handler.java:99)
12-02 11:25:12.300: E/AndroidRuntime(278): at android.os.Looper.loop(Looper.java:123)
12-02 11:25:12.300: E/AndroidRuntime(278): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-02 11:25:12.300: E/AndroidRuntime(278): at java.lang.reflect.Method.invokeNative(Native Method)
12-02 11:25:12.300: E/AndroidRuntime(278): at java.lang.reflect.Method.invoke(Method.java:521)
12-02 11:25:12.300: E/AndroidRuntime(278): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-02 11:25:12.300: E/AndroidRuntime(278): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-02 11:25:12.300: E/AndroidRuntime(278): at dalvik.system.NativeStart.main(Native Method)
12-02 11:25:12.300: E/AndroidRuntime(278): Caused by: java.lang.NullPointerException
12-02 11:25:12.300: E/AndroidRuntime(278): at com.mohammed.watzIslam.Mymain.onCreate(Mymain.java:28)
12-02 11:25:12.300: E/AndroidRuntime(278): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-02 11:25:12.300: E/AndroidRuntime(278): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-02 11:25:12.300: E/AndroidRuntime(278): ... 11 more
12-02 11:25:11.980: E/MediaPlayer(278): Unable to to create media player
12-02 11:25:12.290: D/MediaPlayer(278): create failed:
12-02 11:25:12.290: D/MediaPlayer(278): java.io.IOException: setDataSourceFD failed.: status=0x80000000
12-02 11:25:12.290: D/MediaPlayer(278): at android.media.MediaPlayer.setDataSource(Native Method)
My guess is that you're trying to load a media file that's not there, or the file name is just incorrect.

Using Sharedpreferences in broadcastreceiver due to error

BroadcastReceiver's code is a separate unit SMSReceiver.java. The Receiver declared in the Manifest with an SMS Receive Intent Filter. So it is "always on". When the application is running or just in the list of last 8 application it's working fine when get incoming SMS. But later, when application is deleted from memory, and only receiver stands by, incoming SMS due to error. The fact that I use in receiver's code Sharedpreferences. When I get some information from received SMS I should save it in preferences for loading by main Activity later.
LogCat shows me a string with error.
public class SmsReceiver extends BroadcastReceiver
{
public static SharedPreferences mStatePrefs;
#Override
public void onReceive(Context context, Intent intent)
{
//... some code
SharedPreferences.Editor ed = mStatePrefs.edit(); //HERE I GET AN EXCEPTION
//... some code
}
}
LogCat log..
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): FATAL EXCEPTION: main
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): java.lang.RuntimeException: Unable to start receiver com.example.android.MyApplication.SmsReceiver: java.lang.NullPointerException
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2034)
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): at android.app.ActivityThread.access$2400(ActivityThread.java:132)
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1098)
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): at android.os.Handler.dispatchMessage(Handler.java:99)
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): at android.os.Looper.loop(Looper.java:143)
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): at android.app.ActivityThread.main(ActivityThread.java:4268)
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): at java.lang.reflect.Method.invokeNative(Native Method)
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): at java.lang.reflect.Method.invoke(Method.java:507)
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): at dalvik.system.NativeStart.main(Native Method)
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): Caused by: java.lang.NullPointerException
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): at com.example.android.MyApplication.SmsReceiver.onReceive(SmsReceiver.java:198)
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2019)
12-02 22:36:03.887: ERROR/AndroidRuntime(18345): ... 10 more
So it works fine when app is active or in memory. But when the receiver was left alone, the error has occurred. So what I need to do, to fix this problem? It's a block bug for my app, this receiver is main solution, a sense of program. It must work always and save information in preferences.
You never get a SharedPreference instance for mStatePrefs. Looking at just the code you show, mStatePrefs would still be null.
Try:
mStatePrefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor ed = mStatePrefs.edit();

how to show alert after calling the webservice [duplicate]

This question already has an answer here:
how to show alert inside an activity group?
(1 answer)
Closed 8 years ago.
In my activity I am calling webservices. So after the webservice returns the result, I have to show an alert. Since alert is UI part, I think inside onPostExecute() I have to write the alert code. But when I do like that error is coming.
Error shown:
12-02 09:59:08.508: ERROR/AndroidRuntime(451): Uncaught handler: thread main exiting
due to uncaught exception
12-02 09:59:08.528: ERROR/AndroidRuntime(451):
android.view.WindowManager$BadTokenException: Unable to add window -- token
android.app.LocalActivityManager$LocalActivityRecord#4378eb50 is not valid; is your
activity running?
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
android.view.ViewRoot.setView(ViewRoot.java:456)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
android.view.Window$LocalWindowManager.addView(Window.java:409)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
android.app.Dialog.show(Dialog.java:238)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
android.app.AlertDialog$Builder.show(AlertDialog.java:802)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at com.myapp.android.activities.Register$PostCodeTask.onPostExecute(Register.java:291)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at com.myapp.android.activities.Register$PostCodeTask.onPostExecute(Register.java:1)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
android.os.AsyncTask.finish(AsyncTask.java:416)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
android.os.AsyncTask.access$300(AsyncTask.java:127)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:428)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
android.os.Handler.dispatchMessage(Handler.java:99)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
android.os.Looper.loop(Looper.java:123)
android.app.ActivityThread.main(ActivityThread.java:4203)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
java.lang.reflect.Method.invokeNative(Native Method)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
java.lang.reflect.Method.invoke(Method.java:521)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
12-02 09:59:08.528: ERROR/AndroidRuntime(451): at dalvik.system.NativeStart.main(Native
Method)
Can anyone please help to solve my issue. Thanks in advance :)
You need to execute your alert code in UI thread. There are few ways of doing it for example
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(MyActivity.this, "Hello there", Toast.LENGTH_LONG).show();
}
});

Categories

Resources