I am having adobe sitecatalyst in my android application,
and found several crashes with below mentioned stacktrace.
Fatal Exception: java.lang.OutOfMemoryError: int[] of length 1674283432 exceeds the VM limit
at android.util.ArrayMap.allocArrays(ArrayMap.java:196)
at android.util.ArrayMap.ensureCapacity(ArrayMap.java:307)
at android.os.Bundle.unparcel(Bundle.java:247)
at android.os.Bundle.containsKey(Bundle.java:299)
at com.adobe.mobile.ReferrerHandler.getReferrerURLFromIntent(SourceFile:97)
at com.adobe.mobile.ReferrerHandler.processIntent(SourceFile:63)
at com.adobe.mobile.Analytics$10.run(SourceFile:211)
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)
Somewhere in adobe analytics code, its creating array of bigger size.
Any solution for this ?
I research about the error you faced in your application and I found 2 answers, they all sed to change the javaMaxHeapSize to "4g" inside dexOptions
please check the following link, hope it will work
Android - Java heap space error
android-gradle-what-is-javamaxheapsize-4g
Increase heap size
Try This Application Tag of Manifest file..
<application
android:name=".app.MyApplication"
android:hardwareAccelerated="true"
android:vmSafeMode="true"
android:largeHeap="true">
Related
after upgrading to Android Studio 3.4 and also with Anroid 3.4.1 i am facing an error when I try to build APK (normal run works) :
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
I tried all the suggested changes to gradle-properties withuot success.
It soccurs on task app:transformClassesAndResourcesWithR8ForRelease
Any help would be appreciated :-)
Maybe you need to increase heap size. Like said here: https://stackoverflow.com/a/25013822/6041024
dexOptions {
javaMaxHeapSize "2g"
}
I finally found a solution which is more easier than every other test / trick :-)
I removed the row "org.gradle.jvmargs=" from the gradle.properties in the project folder , but what did the magic was to remove it also from the file (under Windows)
C:\Users[YOUR_USERNAME].gradle\gradle.properties
and everything start working as expect and faster than before :-)
I am working on an application, which was working fine before Android studio and gradle updates. Issue is we have developed the application in a way where some data is stored in DB and Preferences. But now even during complete reinstall of application fetching the OLD local sqlite DB.
Possible cause of this seems: android:allowBackup="true" in Application Tag(Manifest) and solution may lie in android:allowBackup="false" as per the google developer documentation.
But on assigning android:allowBackup="false" is giving me following error:
Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
Even in log file I am unable to understand the cause of the issue.
After android:allowBackup="false" add tools:replace="android:allowBackup.
Source: https://developer.android.com/studio/build/manifest-merge#attribute_markers
Hi I'm in a bit of bind here.
My app doesn't use webview anywhere, and my most frequent crash in Crashlytics is this error : /data/user/0/[myApp]/cache/WebView is not a directory.
The stack trace is minified despite me not using Proguard to minify/obfuscate so it's probably a lib I'm using.
Caused by java.lang.IllegalArgumentException: /data/user/0/[myApp]/cache/WebView is not a directory.
at bHS.<init>(SourceFile:58)
at akR.a(SourceFile:7)
at aoN.call(SourceFile:7)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at aoR.run(SourceFile:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
I'm thinking adMob since it's the only thing that could use a webView or maybe crashlytics itself ?
Has anyone encounter this problem or any lead on how to fix it ?
I tried creating this folder on app startup but it's deleted.
In my case it was that i did not add permissions for internet usage in the manifest:
<uses-permission android:name="android.permission.INTERNET" />
According to this post on the "android-webview-dev" Google Group by a chromium dev:
That looks like a real bug, and it would never show up in our crash reporting because that's crashing in crash handling code.
So it looks like the crash is within Chromium's crash reporting code which... doesn't help you much.
Can you reproduce it at all, or have any users told you how it happened? Additionally, is there any additional information available on Crashlytics (e.g. it only happens on certain Android versions / certain devices)?
When i run my application on a physical device
Every time the application crashes. The LogCat displays "Out of memory and Failed to allocate a 74649612 byte allocation with 16768392 free bytes and 49MB until OOM "
The device I am using is Xiaomi RedMi note 4
3GB RAM
Android version 7.0
Processor Qualcomm Snapdragon 625
Here is the LogCat message
java.lang.OutOfMemoryError: Failed to allocate a 74649612 byte allocation with 16768392 free bytes and 49MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:624)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:457)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1152)
at android.content.res.ResourcesImpl.createFromResourceStream(ResourcesImpl.java:1272)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:743)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:585)
at android.content.res.MiuiResourcesImpl.loadDrawable(MiuiResourcesImpl.java:308)
at android.content.res.Resources.getDrawable(Resources.java:785)
at android.content.res.Resources.getDrawable(Resources.java:756)
at com.suman.udit.su.MainActivity.onCreate(MainActivity.java:52)
at android.app.Activity.performCreate(Activity.java:6852)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2700)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2808)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:165)
at android.app.ActivityThread.main(ActivityThread.java:6365)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:883)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
Looks like the Drawable (picture, perhaps?) you are trying to load at MainActivity.java:52 is too big. You also might try putting it in the drawable-nodpi folder, so that the system doesn't try to re-scale it upon load.
OutOfMemoryError is the most common problem occured in android while especially dealing with bitmaps. This error is thrown by the Java Virtual Machine (JVM) when an object cannot be allocated due to lack of memory space and also, the garbage collector cannot free some space.
As mentioned by Aleksey, you can add below entities in your manifest file android:hardwareAccelerated="false" , android:largeHeap="true" it will work for some environment's.
<application
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme">
you should definately read some of Androids Developer concept's, specially here:Displaying Bitmaps Efficiently
Read all 5 topics and rewrite your code again. If it still doesn't work we will be happy to see what you've done wrong with the tutorial material.
Here some of possible answers for these type of errors in SOF
Android: BitmapFactory.decodeStream() out of memory with a 400KB file with 2MB free heap
How to solve java.lang.OutOfMemoryError trouble in Android
Android : java.lang.OutOfMemoryError
java.lang.OutOfMemoryError
Solution for OutOfMemoryError: bitmap size exceeds VM budget
I am running a Jenkins build of an Android project on a Mac Mini (10.9.5). The Jenkins build is failing with error messages like this:
<package>.myTest > test_myTest FAILED
org.mockito.cglib.core.CodeGenerationException at test_myTest.java:65
Caused by: java.lang.reflect.InvocationTargetException at test_myTest.java:65
Caused by: java.lang.OutOfMemoryError at test_myTest.java:65
java.lang.OutOfMemoryError: PermGen space
This is sometimes followed by messages like
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "/0:0:0:0:0:0:0:1:50340 to /0:0:0:0:0:0:0:1:50339 workers Thread 2"
16:47:17
16:47:17 Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "/0:0:0:0:0:0:0:1:50340 to /0:0:0:0:0:0:0:1:50339 workers Thread 4"
16:47:18
16:47:18 Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "/0:0:0:0:0:0:0:1:50340 to /0:0:0:0:0:0:0:1:50339 workers Thread 5"
16:47:18
16:47:18 Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "/0:0:0:0:0:0:0:1:50340 to /0:0:0:0:0:0:0:1:50339 workers Thread 6"
16:47:19
It usually fails at the same point in the build. According to the Jenkins wiki
Do you consistently see OOME around the same phase in a build? If so, maybe it just needs a bigger memory.
this may mean I just need more PermGen space.
The stackoverflow posts/blog posts I've read indicate that I need to increase the max PermGen size (-XX:MaxPermSize=1024M, for example). However, I'm not clear on where to do this.
I've changed this for GRADLE_OPTS and JAVA_OPTS so my Jenkins build environment looks like this:
As seen in the screenshot, I also added some options to garbage collect Perm Gen as recommended here.
This seemed to be working--I had a few successful builds yesterday, but it's now failing again (with no changes that I'm aware of).
After reading this answer, I also changed the following line in my project's gradle.properties file.
org.gradle.jvmargs=-Xms1024M -Xmx2048M -XX:PermSize=512M -XX:MaxPermSize=2048 -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
This hasn't fixed the problem.
Answers to similar questions like this and this make me think I may be approaching this the wrong way--should I be changing a computer setting for the Mac (10.9.5) which is running Jenkins? What is the correct way to modify the PermGen space?
Edit: I had previously thought that perhaps the environmental variables weren't being set, but I verified that they appear under the build result Environmental Variables (jenkins/job/<Project>/146/injectedEnvVars/)
As Integrating Stuff said, it was necessary to increase the MaxPermSize for the unit tests. I found how to do so here in the "Running from Gradle" section.
android {
testOptions {
unitTests.all {
jvmArgs '-XX:MaxPermSize=1024m' //prevent OOM (PermGen space) while running tests
}
}
...
}
The memory settings are set per running JVM process. So you definitely do not need to set any OS variables or system wide settings to fix this.
You first need to determine which process is throwing the error.
I am assuming it is the Gradle build and not the Jenkins itself.
It it is the Gradle build, you still do not know which process.
By default, the Gradle Test task executes the tests in a separate jvm, so changing the values in gradle.properties will not help you in such a case.
In such case, you need to configure your Gradle Test task correctly, for example:
test {
jvmArgs "-XX:MaxPermSize=2048m"
}