How to fix Error when committing to Realm - java

I am developing android app that uses Realm as Database but i get an error when excuting commitTransiction() method in Relm
this is the method that make a crash
if (food!= null) {
foodDb.beginTransaction();
food.setChatName(group.getName());
food.setChatImage(group.getImage());
food.setChatStatus(group.getStatus());
foodDb.commitTransaction();
}
and this is the logcat Error I got :
11-30 23:15:06.486 4480-4480/com.yourapp.chatapp E/REALM_JNI: jni: ThrowingException 2, Out of range in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsList.cpp line 135(requested: 4294967295 valid: 0), .
Exception has been thrown: Out of range in /Users/cm/Realm/realm-
java/realm/realm-library/src/main/cpp/io_realm_internal_OsList.cpp line
135(requested: 4294967295 valid: 0)
11-30 23:15:06.496 4480-4480/com.yourapp.chatapp E/dalvikvm: VM aborting
11-30 23:15:06.496 4480-4480/com.yourapp.chatapp A/libc: Fatal signal 6
(SIGABRT) at 0x00001180 (code=-6), thread 4480 (yourapp.chatapp)

Related

App crash while frequent requesting mediafile with exoplayer instances

I am getting this error why frequently try to tap exoplayer instances.
normally instances releases and nulls itself on everytime.
But after some tries app freezes and crashes. I am trying to find where is the problem related
2019-04-04 11:40:36.002 540-1196/? E/BufferQueueProducer: [com..app.musicplayer/com..app.musicplayer.dashboard.DashboardMusicActivity#0] dequeueBuffer: attempting to exceed the max dequeued buffer count (2)
2019-04-04 11:40:36.110 13761-15052/com..app.musicplayer E/NativeCrypto: AppData::create pipe(2) failed: Too many open files
2019-04-04 11:40:36.121 13761-15052/com..app.musicplayer E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
Process: com..app.musicplayer, PID: 13761
java.lang.RuntimeException: javax.net.ssl.SSLException: Unable to create application data
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.newSsl(ConscryptFileDescriptorSocket.java:161)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.<init>(ConscryptFileDescriptorSocket.java:152)
at com.android.org.conscrypt.OpenSSLSocketFactoryImpl.createSocket(OpenSSLSocketFactoryImpl.java:149)
at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:288

android.media.AudioRecord; error

I tried to make a tuner for my guitar in android app.
For this I've to used the library AudioRecord.java, but at the compiation an error appears:
07-03 13:48:49.041 2391-2426/? E/AudioRecord: AudioFlinger could not create record track, status: -1
07-03 13:48:49.044 2391-2426/? E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -1.
07-03 13:48:49.044 2391-2426/? E/android.media.AudioRecord: Error code -20 when initializing native AudioRecord object.
--------- beginning of crash
07-03 13:48:49.046 2391-2426/? E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: com.example.gaetan.tuner, PID: 2391
java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
at android.media.AudioRecord.startRecording(AudioRecord.java:976)
at com.example.gaetan.tuner.audio.CaptureThread.run(CaptureThread.java:34)
And in AudioRecord.java I can see
import android.os.ServiceManager; cannot be resolved
What can I do to change that?
The issue is likley to do with supported sample rates. The following code will give you a predicate for checking if your desired sample rate is supported.
int sampleRate = 44100;
int bufferSize = AudioRecord.getMinBufferSize(44100, AudioFormat.CHANNEL_CONFIGURATION_DEFAULT, AudioFormat.ENCODING_PCM_16BIT);
if (bufferSize > 0) {
//the sample rate is supported so create your AudioRecord
} else {
// sample size is not supported
}
For a more advanced version featuring that supports multiple sample rates see the answer given here

how to fix google+ login connection in android?

Hi I'm android beginner
My code had worked a few days ago , suddenly there was problem
How did these errors come from?
Error log
05-18 11:01:52.756 710-722/? E/DatabaseUtils: Writing exception to parcel
java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:15401)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2512)
at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:685)
at android.content.ContentProvider$Transport.call(ContentProvider.java:325)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:275)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)
....
05-18 11:01:52.796 748-748/com.buttering.roler E/Login_Activity: Connection to Play Services Failed, error: 4, reason: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{426e34f0: android.os.BinderProxy#423cbdb8}, message=null}
05-18 11:01:52.796 710-1728/? E/Parcel: Class not found when unmarshalling: com.google.android.gms.common.api.Scope
java.lang.ClassNotFoundException: com.google.android.gms.common.api.Scope
at java.lang.Class.classForName(Native Method)
it clearly say
Connection to Play Services Failed, error: 4, reason: ConnectionResult{statusCode=SIGN_IN_REQUIRED
SIGNIN_REQUIRED
public static final int SIGN_IN_REQUIRED
The client attempted to connect to the service but the user is not
signed in. The client may choose to continue without using the API.
Alternately, if hasResolution() returns true the client may call
startResolutionForResult(Activity, int) to prompt the user to sign in.
After the sign in activity returns with RESULT_OK further attempts
should succeed.
Constant Value: 4

java.lang.OutOfMemoryError: Could not allocate JNI Env always android java

i am running AsyncTask
java.lang.OutOfMemoryError: Could not allocate JNI Env
at java.lang.Thread.nativeCreate(Native Method)
at java.lang.Thread.start(Thread.java:1063)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:921)
at java.util.concurrent.ThreadPoolExecutor.processWorkerExit(ThreadPoolExecutor.java:989)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1131)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
i get this error the next time i run the app and do the same task,first time task is completed without any porblem and no crashes and when i back press and exit the app and come back and do the same task it shows this error
[ 11-06 22:20:02.741 1174: 1219 D/ ]
NULL ==
surf->write_back_color_buffer
11-06 22:20:02.741 1174-1219/com.package A/OpenGLRenderer: Encountered EGL error 12291 EGL_BAD_ALLOC during rendering
11-06 22:20:02.741 1174-1219/com.package A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 1219 (RenderThread)
never had this problem before
okay that error was due to inputstream i forgot to close in one module,so if you guys use any stream,double check it and make sure you close all stream you open :)

java.lang.VerifyError when downloading data with jsoup in Android N

I compiled my Android app for the new Android N version and then tried to test it on an emulator. It runs normally until I try to download and parse some website data using the "jsoup" library. Then I get this java.lang.VerifyError:
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.masrepus.vplanapp, PID: 6584
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:318)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
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)
Caused by: java.lang.VerifyError: Verifier rejected class org.jsoup.parser.HtmlTreeBuilderState$7: boolean org.jsoup.parser.HtmlTreeBuilderState$7.process(org.jsoup.parser.Token, org.jsoup.parser.HtmlTreeBuilder) failed to verify: boolean org.jsoup.parser.HtmlTreeBuilderState$7.process(org.jsoup.parser.Token, org.jsoup.parser.HtmlTreeBuilder): [0x140B] Invalid reg type for array index (Reference: org.jsoup.nodes.Node[]) (declaration of 'org.jsoup.parser.HtmlTreeBuilderState$7' appears in /data/app/com.masrepus.vplanapp-2/base.apk)
at org.jsoup.parser.HtmlTreeBuilderState.<clinit>(HtmlTreeBuilderState.java:246)
at org.jsoup.parser.HtmlTreeBuilder.parse(HtmlTreeBuilder.java:53)
at org.jsoup.parser.Parser.parseInput(Parser.java:30)
at org.jsoup.helper.DataUtil.parseByteData(DataUtil.java:81)
at org.jsoup.helper.HttpConnection$Response.parse(HttpConnection.java:517)
at org.jsoup.helper.HttpConnection.post(HttpConnection.java:174)
at com.masrepus.vplanapp.network.AsyncDownloader.updateAvailableFilesList(AsyncDownloader.java:961)
at com.masrepus.vplanapp.network.AsyncDownloader.downloadVplan(AsyncDownloader.java:237)
at com.masrepus.vplanapp.network.AsyncDownloader.doInBackground(AsyncDownloader.java:135)
at com.masrepus.vplanapp.network.AsyncDownloader.doInBackground(AsyncDownloader.java:113)
at android.os.AsyncTask$2.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) 
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) 
While researching on VerifyErrors, I came across some solutions, like cleaning the project build folder. But those solutions didn't help.
What I am wondering is, what [0x140B] Invalid reg type for array index means. This may be the thing I have to resolve, but I don't know how.
Edit:
So I dove a bit deeper into the problem and located the crash inside the block named "InBody" in org.jsoup.parser.HtmlTreeBuilderState, lines 244-759. I don't know why, but when I set breakpoints there, the program never stops there, so I have no clue at which exact position inside this block the crash happens. But as the error message speaks of some sort of array index, I figured it might be one of the 6 for-loops I found that have something to do with the data type "Element": They are at lines 305, 388, 561, 582, 602 and 640
Disable jack.
I got the same error when I enable jack. I disabled jack and compiled, no error. Then I copied jsoup source code to my project folder, enabled jack and compiled, no error. So I think it is a bug of jill, the tool to convert *.class to *.jack.

Categories

Resources