Android App get Stopped When Changing the orientation - android

I am creating an Android app. I want it to work in both orientations. When I run it in landscape mode it works well but while changing it to portrait,the app stopped. again I open it will work normally. this is my problem. when I change the orientation. First time it shows error. help me to solve this issue.
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: java.lang.RuntimeException: An error occured while executing doInBackground()
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at android.os.AsyncTask$3.done(AsyncTask.java:299)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:239)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at java.lang.Thread.run(Thread.java:856)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: Caused by: java.lang.OutOfMemoryError
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:529)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:302)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at com.infizoom.smartselfie2.Helper.decodeSampledBitmapFromPath(Helper.java:32)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at com.infizoom.smartselfie2.FrameActivity.LoadImagesFromLocalDb(FrameActivity.java:195)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at com.infizoom.smartselfie2.FrameActivity$LoadImagesIntoLocal.doInBackground(FrameActivity.java:136)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at com.infizoom.smartselfie2.FrameActivity$LoadImagesIntoLocal.doInBackground(FrameActivity.java:114)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at android.os.AsyncTask$2.call(AsyncTask.java:287)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:234)
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
11-05 16:40:44.010 10204-10250/com.infizoom.smartselfie2 E/AndroidRuntime: at java.lang.Thread.run(Thread.java:856) 

You are getting an OutOfMemory exception when your activity gets recreated after orientation change.
I could guess in your FrameActivity you are leaking bitmaps on every activity creation not allowing the GC to free up enough memory.

Related

How do I fix this java.lang.NoSuchMethodError?

View the FATAL EXCEPTION error message below:
02-23 23:42:41.596 9581-9705/com.example.restapi_user E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.example.restapi_user, PID: 9581
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.NoSuchMethodError: com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient$Builder.setBatchPath
at com.example.echo.dbquery.Dbquery$Builder.setBatchPath(Dbquery.java:586)
at com.example.echo.dbquery.Dbquery$Builder.<init>(Dbquery.java:565)
at com.example.restapi_user.MainActivity$ExecuteApiCall.doInBackground(MainActivity.java:127)
at com.example.restapi_user.MainActivity$ExecuteApiCall.doInBackground(MainActivity.java:116)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
at java.lang.Thread.run(Thread.java:841)
How do I fix this problem? I already tried cleaning and then rebuilding my project.

Error when try to download image File Using Amazon Mobile S3 bucket SDK for Android

I try to download file using Amazon Mobile SDK Android. I created my bucket, in the permissions I set that everyone can write and read. In amazon Cognito I just left everything as default.
I get this error when try download any file from my bucket...
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 E/AndroidRuntime: java.lang.RuntimeException: An error occured while executing doInBackground() E/AndroidRuntime: at android.os.AsyncTask$3.done(AsyncTask.java:299) E/AndroidRuntime: at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) E/AndroidRuntime: at java.util.concurrent.FutureTask.setException(FutureTask.java:219) E/AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:239) E/AndroidRuntime: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) E/AndroidRuntime: at java.lang.Thread.run(Thread.java:856) E/AndroidRuntime: Caused by: com.amazonaws.services.s3.model.AmazonS3Exception: Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: 09C37F19011C99ED), S3 Extended Request ID: NrSazbQ1KzqpB/6+YLHiE/vPt1W72zEXGF6TB5uP9vl92Apktzj8hgsz4lJKVhpDodzVMoxzO6Y= E/AndroidRuntime: at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:709) E/AndroidRuntime: at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:385) E/AndroidRuntime: at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:196) E/AndroidRuntime: at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4204) E/AndroidRuntime: at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4161) E/AndroidRuntime: at com.amazonaws.services.s3.AmazonS3Client.listObjects(AmazonS3Client.java:657) E/AndroidRuntime: at com.amazonaws.services.s3.AmazonS3Client.listObjects(AmazonS3Client.java:628) E/AndroidRuntime: at com.example.admin.amazons3download.DownloadSelectionActivity$GetFileListTask.doInBackground(DownloadSelectionActivity.java:129) E/AndroidRuntime: at com.example.admin.amazons3download.DownloadSelectionActivity$GetFileListTask.doInBackground(DownloadSelectionActivity.java:113) E/AndroidRuntime: at android.os.AsyncTask$2.call(AsyncTask.java:287) E/AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:234) E/AndroidRuntime: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)  E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)  E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)  E/AndroidRuntime: at java.lang.Thread.run(Thread.java:856)
you have to include below library in gradle
compile 'com.amazonaws:aws-android-sdk-core:2.2.13'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.13'
and get pool id and bucket name while creating bucket and using that information download or upload file. For more use the link https://www.numetriclabz.com/integrate-amazon-s3-to-android-tutorial/
It will help you out.

fatal exception asyncClass #3

11-05 00:07:20.204: E/AndroidRuntime(892): FATAL EXCEPTION: AsyncTask #3
11-05 00:07:20.204: E/AndroidRuntime(892): java.lang.RuntimeException: An error occured while executing doInBackground()
11-05 00:07:20.204: E/AndroidRuntime(892): at android.os.AsyncTask$3.done(AsyncTask.java:299)
11-05 00:07:20.204: E/AndroidRuntime(892): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
11-05 00:07:20.204: E/AndroidRuntime(892): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
11-05 00:07:20.204: E/AndroidRuntime(892): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
11-05 00:07:20.204: E/AndroidRuntime(892): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
11-05 00:07:20.204: E/AndroidRuntime(892): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
11-05 00:07:20.204: E/AndroidRuntime(892): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
11-05 00:07:20.204: E/AndroidRuntime(892): at java.lang.Thread.run(Thread.java:841)
11-05 00:07:20.204: E/AndroidRuntime(892): Caused by: java.lang.VerifyError: net/sourceforge/jtds/jdbc/TdsCore
11-05 00:07:20.204: E/AndroidRuntime(892): at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:359)
11-05 00:07:20.204: E/AndroidRuntime(892): at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
11-05 00:07:20.204: E/AndroidRuntime(892): at java.sql.DriverManager.getConnection(DriverManager.java:179)
11-05 00:07:20.204: E/AndroidRuntime(892): at java.sql.DriverManager.getConnection(DriverManager.java:144)
11-05 00:07:20.204: E/AndroidRuntime(892): at com.example.zzzsqldb.ConnectionClass.CONN(ConnectionClass.java:34)
11-05 00:07:20.204: E/AndroidRuntime(892): at com.example.zzzsqldb.MainActivity$DoLogin.doInBackground(MainActivity.java:72)
11-05 00:07:20.204: E/AndroidRuntime(892): at com.example.zzzsqldb.MainActivity$DoLogin.doInBackground(MainActivity.java:1)
11-05 00:07:20.204: E/AndroidRuntime(892): at android.os.AsyncTask$2.call(AsyncTask.java:287)
11-05 00:07:20.204: E/AndroidRuntime(892): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
11-05 00:07:20.204: E/AndroidRuntime(892): ... 4 more

Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.gcm.GoogleCloudMessaging using flex

I am developing an Android native extension for push notification. I have added the gcm library to the class path but the class GoogleCloudMessaging could not be found. Even thought the jar from google is added to the class path of the android project, I still get the error message, so after I export the jar I am updating with the classes from the Google gcm jar. After this everything looks ok at jar level but the problem still persist and I have the following error:
W/dalvikvm(10513): VFY: unable to resolve static method 2592: Lcom/google/android/gms/gcm/GoogleCloudMessaging;.getInstance (Landroid/content/Context;)Lcom/google/android/gms/gcm/GoogleCloudMessaging;
08-17 19:32:10.328: W/dalvikvm(10513): threadid=16: thread exiting with uncaught exception (group=0x40adb9f0)
08-17 19:32:10.348: E/AndroidRuntime(10513): FATAL EXCEPTION: AsyncTask #1
08-17 19:32:10.348: E/AndroidRuntime(10513): java.lang.RuntimeException: An error occured while executing doInBackground()
08-17 19:32:10.348: E/AndroidRuntime(10513): at android.os.AsyncTask$3.done(AsyncTask.java:278)
08-17 19:32:10.348: E/AndroidRuntime(10513): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
08-17 19:32:10.348: E/AndroidRuntime(10513): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
08-17 19:32:10.348: E/AndroidRuntime(10513): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
08-17 19:32:10.348: E/AndroidRuntime(10513): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
08-17 19:32:10.348: E/AndroidRuntime(10513): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
08-17 19:32:10.348: E/AndroidRuntime(10513): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
08-17 19:32:10.348: E/AndroidRuntime(10513): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
08-17 19:32:10.348: E/AndroidRuntime(10513): at java.lang.Thread.run(Thread.java:856)
08-17 19:32:10.348: E/AndroidRuntime(10513): Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.gcm.GoogleCloudMessaging
08-17 19:32:10.348: E/AndroidRuntime(10513): at com.microsoft.windowsazure.notifications.NotificationsManager$1.doInBackground(NotificationsManager.java:43)
08-17 19:32:10.348: E/AndroidRuntime(10513): at com.microsoft.windowsazure.notifications.NotificationsManager$1.doInBackground(NotificationsManager.java:1)
08-17 19:32:10.348: E/AndroidRuntime(10513): at android.os.AsyncTask$2.call(AsyncTask.java:264)
08-17 19:32:10.348: E/AndroidRuntime(10513): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
08-17 19:32:10.348: E/AndroidRuntime(10513): ... 5 more

Activity started without an EXTRA_ACCOUNT when using native sharing on GooglePlus SDK

I have a Google+ connection in my app, and when I try to get the user's information with a Person Object, everything works just fine.
but when I'm using the Share dialog as stated in the documentation, I get a crash in the G+ library.
here is the code I'm using for this:
Intent shareIntent = new PlusShare.Builder(getActivity())
.setType("text/plain")
.setText(getString(R.string.application_sharing_default_share_with_friends))
.setContentUrl(Uri.parse(shareLink))
.getIntent();
startActivityForResult(shareIntent, 0);
and when I run this all I get is this error and crash:
11-05 11:30:51.093: E/AndroidRuntime(617): FATAL EXCEPTION: main
11-05 11:30:51.093: E/AndroidRuntime(617): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.apps.plus/com.google.android.apps.plus.phone.ShareActivity}: java.lang.IllegalStateException: Activity started without an EXTRA_ACCOUNT
11-05 11:30:51.093: E/AndroidRuntime(617): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
11-05 11:30:51.093: E/AndroidRuntime(617): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
11-05 11:30:51.093: E/AndroidRuntime(617): at android.app.ActivityThread.access$600(ActivityThread.java:130)
11-05 11:30:51.093: E/AndroidRuntime(617): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
11-05 11:30:51.093: E/AndroidRuntime(617): at android.os.Handler.dispatchMessage(Handler.java:99)
11-05 11:30:51.093: E/AndroidRuntime(617): at android.os.Looper.loop(Looper.java:137)
11-05 11:30:51.093: E/AndroidRuntime(617): at android.app.ActivityThread.main(ActivityThread.java:4745)
11-05 11:30:51.093: E/AndroidRuntime(617): at java.lang.reflect.Method.invokeNative(Native Method)
11-05 11:30:51.093: E/AndroidRuntime(617): at java.lang.reflect.Method.invoke(Method.java:511)
11-05 11:30:51.093: E/AndroidRuntime(617): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-05 11:30:51.093: E/AndroidRuntime(617): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-05 11:30:51.093: E/AndroidRuntime(617): at dalvik.system.NativeStart.main(Native Method)
11-05 11:30:51.093: E/AndroidRuntime(617): Caused by: java.lang.IllegalStateException: Activity started without an EXTRA_ACCOUNT
11-05 11:30:51.093: E/AndroidRuntime(617): at brz.onCreate(PG:169)
11-05 11:30:51.093: E/AndroidRuntime(617): at com.google.android.apps.plus.phone.PostActivity.onCreate(PG:77)
11-05 11:30:51.093: E/AndroidRuntime(617): at com.google.android.apps.plus.phone.ShareActivity.onCreate(PG:156)
11-05 11:30:51.093: E/AndroidRuntime(617): at android.app.Activity.performCreate(Activity.java:5008)
11-05 11:30:51.093: E/AndroidRuntime(617): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
11-05 11:30:51.093: E/AndroidRuntime(617): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
11-05 11:30:51.093: E/AndroidRuntime(617): ... 11 more
This was a bug in the Google+ app that is fixed in the latest build that came out today: https://plus.google.com/101870761930221849874/posts/KohXe9pBGF6 Sorry about that.
Check your g+ app first, it is likely the g+ account is not completely set up. Go to the g+ and follow the steps to have at least one g+ account set up and the error should be gone.

Categories

Resources