I am using Crashlytics version 2.6.8 for my Android app. I have configured Crashlytics in base feature following answer here. Crashlystics is initialized with Fabric using following code snippet
Fabric.with(context, crashlyticsKit);
Crashlytics Answers throws this exception on startup of Android instant apps
E/Answers: Failed to enable events
java.io.IOException: ftruncate failed: EACCES (Permission denied)
at java.io.RandomAccessFile.setLength(RandomAccessFile.java:630)
at io.fabric.sdk.android.services.common.QueueFile.initialize(QueueFile.java:213)
at io.fabric.sdk.android.services.common.QueueFile.<init>(QueueFile.java:130)
at io.fabric.sdk.android.services.events.QueueFileEventStorage.<init>(QueueFileEventStorage.java:58)
at io.fabric.sdk.android.services.events.GZIPQueueFileEventStorage.<init>(GZIPQueueFileEventStorage.java:32)
at com.crashlytics.android.answers.AnswersFilesManagerProvider.getAnalyticsFilesManager(AnswersFilesManagerProvider.java:44)
at com.crashlytics.android.answers.AnswersEventsHandler$4.run(AnswersEventsHandler.java:121)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:75)
at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
at java.lang.Thread.run(Thread.java:818)
Caused by: android.system.ErrnoException: ftruncate failed: EACCES (Permission denied)
at libcore.io.Posix.ftruncate(Native Method)
at libcore.io.BlockGuardOs.ftruncate(BlockGuardOs.java:148)
at java.io.RandomAccessFile.setLength(RandomAccessFile.java:628)
Is it caused due to storage access? If so, Is it possible to configure Crashlytics from accessing storage in case of Instant apps?
It doesn't seem like you are initializing Answers itself, only Crashlytics?
Try something like this if you want Crashlytics and Answers from Fabric:
final Fabric fabric = new Fabric.Builder(this)
.kits(new Crashlytics(), new Answers())
.debuggable(true)
.build();
Fabric.with(fabric);
Related
According to the documentation
https://developer.android.com/training/data-storage/manage-all-files#operations-allowed-manage-external-storage, MANAGE_EXTERNAL_STORAGE permission grant access to root directory of the USB (OTG) drive.
val sm = application.getSystemService(Context.STORAGE_SERVICE) as StorageManager
val sv = sm.storageVolumes
sv.forEach{
val curVolStats = StatFs(it.directory.toString())
}
The above code works well for Primary Storage and SDCARD. For the USB OTG drive, this return below error message:
2022-09-14 11:03:28.456 14141-14141/com.starsolutions.starfilemanager E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.starsolutions.starfilemanager, PID: 14141
java.lang.IllegalArgumentException: Invalid path: /mnt/media_rw/7ACF-B2AD
at android.os.StatFs.doStat(StatFs.java:53)
at android.os.StatFs.<init>(StatFs.java:43)
at com.starsolutions.starfilemanager.data.ExplorerDataSource.getVolumes(ExplorerDataSource.kt:36)
at com.starsolutions.starfilemanager.data.ExplorerRepository$getVolumeDetails$2.invokeSuspend(ExplorerRepository.kt:20)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}#d17c76f, Dispatchers.Main.immediate]
Caused by: android.system.ErrnoException: statvfs failed: EACCES (Permission denied)
Please help me where is my mistake?
I reported this in
Google issue tracker.
They are replied issue is fixed in S build.
When I leave the Google Places API on idle after initialization, the application crashes with the stack trace as described at the end of this description.
I initialize the Places API once and only once in the manner described below
if(!Places.isInitialized()) {
val apiKey = loadApiKey()
Places.initialize(getApplication(), apiKey)
}
val client = Places.createClient(getApplication())
After running the above method and left on idle, the application crashes with the following stack trace.
I am assuming this is happening because of a clash between my javalite libraries and the protobuf java libraries.
java.lang.ExceptionInInitializerError
at com.google.android.datatransport.cct.a.zze.zzb(com.google.android.datatransport:transport-backend-cct##2.1.0:1)
at com.google.android.datatransport.cct.zzc.send(com.google.android.datatransport:transport-backend-cct##2.1.0:9)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.logAndUpdateState(com.google.android.datatransport:transport-runtime##2.1.0:121)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.lambda$upload$1(com.google.android.datatransport:transport-runtime##2.1.0:88)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader$$Lambda$1.run(Unknown Source:8)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.RuntimeException: Unable to get message info for com.google.android.datatransport.cct.a.zze
at com.google.protobuf.GeneratedMessageInfoFactory.messageInfoFor(GeneratedMessageInfoFactory.java:62)
at com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory.messageInfoFor(ManifestSchemaFactory.java:143)
at com.google.protobuf.ManifestSchemaFactory.createSchema(ManifestSchemaFactory.java:55)
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:93)
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:107)
at com.google.protobuf.GeneratedMessageLite.makeImmutable(GeneratedMessageLite.java:175)
at com.google.android.datatransport.cct.a.zze.<clinit>(com.google.android.datatransport:transport-backend-cct##2.1.0:2)
at com.google.android.datatransport.cct.a.zze.zzb(com.google.android.datatransport:transport-backend-cct##2.1.0:1)
at com.google.android.datatransport.cct.zzc.send(com.google.android.datatransport:transport-backend-cct##2.1.0:9)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.logAndUpdateState(com.google.android.datatransport:transport-runtime##2.1.0:121)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.lambda$upload$1(com.google.android.datatransport:transport-runtime##2.1.0:88)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader$$Lambda$1.run(Unknown Source:8)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.UnsupportedOperationException
at com.google.android.datatransport.cct.a.zze.dynamicMethod(com.google.android.datatransport:transport-backend-cct##2.1.0:2)
at com.google.protobuf.GeneratedMessageLite.dynamicMethod(GeneratedMessageLite.java:256)
at com.google.protobuf.GeneratedMessageLite.buildMessageInfo(GeneratedMessageLite.java:284)
at com.google.protobuf.GeneratedMessageInfoFactory.messageInfoFor(GeneratedMessageInfoFactory.java:60)
at com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory.messageInfoFor(ManifestSchemaFactory.java:143)
at com.google.protobuf.ManifestSchemaFactory.createSchema(ManifestSchemaFactory.java:55)
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:93)
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:107)
at com.google.protobuf.GeneratedMessageLite.makeImmutable(GeneratedMessageLite.java:175)
at com.google.android.datatransport.cct.a.zze.<clinit>(com.google.android.datatransport:transport-backend-cct##2.1.0:2)
at com.google.android.datatransport.cct.a.zze.zzb(com.google.android.datatransport:transport-backend-cct##2.1.0:1)
at com.google.android.datatransport.cct.zzc.send(com.google.android.datatransport:transport-backend-cct##2.1.0:9)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.logAndUpdateState(com.google.android.datatransport:transport-runtime##2.1.0:121)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.lambda$upload$1(com.google.android.datatransport:transport-runtime##2.1.0:88)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader$$Lambda$1.run(Unknown Source:8)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
There might be an issue with the library's protobuffer integration clashing with the one I am using within my application.
As per this issue tracker I created and mentioned by the comments.
https://issuetracker.google.com/issues/161157921.
For now, simply add the following to update the internal Places dependencies on Protobufer libraries until they push out a Places version > 2.3.0
implementation 'com.google.android.datatransport:transport-runtime:2.2.3'
implementation 'com.google.android.datatransport:transport-backend-cct:2.3.0'
Recently I see an exception in my log that fabric (Beta) tries to check for updates and this is the error:
E/Beta: Error while checking for updates from null
io.fabric.sdk.android.services.network.HttpRequest$HttpRequestException: java.net.MalformedURLException: Protocol not found: null?instance=
I don't know why fabric tries to check for updates with a null URL, but I really want to remove that error.
Verbose stack trace:
E/Beta: Error while checking for updates from null
io.fabric.sdk.android.services.network.HttpRequest$HttpRequestException: java.net.MalformedURLException: Protocol not found: null?instance=7f856ab5-12f8-4723-9e84-569dab8e9760&build_version=1030300&display_version=1.3.3&source=3
at io.fabric.sdk.android.services.network.HttpRequest.encode(HttpRequest.java:722)
at io.fabric.sdk.android.services.network.HttpRequest.get(HttpRequest.java:865)
at io.fabric.sdk.android.services.network.DefaultHttpRequestFactory.buildHttpRequest(DefaultHttpRequestFactory.java:85)
at io.fabric.sdk.android.services.common.AbstractSpiCall.getHttpRequest(AbstractSpiCall.java:137)
at com.crashlytics.android.beta.CheckForUpdatesRequest.invoke(CheckForUpdatesRequest.java:48)
at com.crashlytics.android.beta.AbstractCheckForUpdatesController.performUpdateCheck(AbstractCheckForUpdatesController.java:166)
at com.crashlytics.android.beta.AbstractCheckForUpdatesController.checkForUpdates(AbstractCheckForUpdatesController.java:139)
at com.crashlytics.android.beta.AbstractCheckForUpdatesController.initialize(AbstractCheckForUpdatesController.java:91)
at com.crashlytics.android.beta.Beta.doInBackground(Beta.java:78)
at com.crashlytics.android.beta.Beta.doInBackground(Beta.java:30)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.net.MalformedURLException: Protocol not found: null?instance=7f856ab5-12f8-4723-9e84-569dab8e9760&build_version=1030300&display_version=1.3.3&source=3
at java.net.URL.<init>(URL.java:176)
at java.net.URL.<init>(URL.java:125)
at io.fabric.sdk.android.services.network.HttpRequest.encode(HttpRequest.java:720)
at io.fabric.sdk.android.services.network.HttpRequest.get(HttpRequest.java:865)
at io.fabric.sdk.android.services.network.DefaultHttpRequestFactory.buildHttpRequest(DefaultHttpRequestFactory.java:85)
at io.fabric.sdk.android.services.common.AbstractSpiCall.getHttpRequest(AbstractSpiCall.java:137)
at com.crashlytics.android.beta.CheckForUpdatesRequest.invoke(CheckForUpdatesRequest.java:48)
at com.crashlytics.android.beta.AbstractCheckForUpdatesController.performUpdateCheck(AbstractCheckForUpdatesController.java:166)
at com.crashlytics.android.beta.AbstractCheckForUpdatesController.checkForUpdates(AbstractCheckForUpdatesController.java:139)
at com.crashlytics.android.beta.AbstractCheckForUpdatesController.initialize(AbstractCheckForUpdatesController.java:91)
at com.crashlytics.android.beta.Beta.doInBackground(Beta.java:78)
at com.crashlytics.android.beta.Beta.doInBackground(Beta.java:30)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
I solved a lot of errors logs and the exception above by updating the crashlytics library version.
I also have solved this issue updating Crashlytics version in /app/build.gradle file.
I leave here the code of the fix for convenienece:
dependencies {
compile('com.crashlytics.sdk.android:crashlytics:2.9.4#aar') {
transitive = true;
}
}
I'm just trying to migrate Fabric Crashlytics with Firebase, so I just followed the guide https://firebase.google.com/docs/crashlytics/get-started
Everything compiles and the app can be launched. So I want to simulate a crash with Crashlytics.getInstance().crash(); as I already used before.
The app crashes as expected, but the crash is not uploaded to firebase and I have this strange stack:
E/Fabric: Error performing auto configuration.
io.fabric.sdk.android.services.network.HttpRequest$HttpRequestException: java.net.ProtocolException: Too many follow-up requests: 21
at io.fabric.sdk.android.services.network.HttpRequest.code(HttpRequest.java:1355)
at io.fabric.sdk.android.services.settings.AbstractAppSpiCall.invoke(AbstractAppSpiCall.java:86)
at io.fabric.sdk.android.services.settings.UpdateAppSpiCall.invoke(UpdateAppSpiCall.java:29)
at io.fabric.sdk.android.Onboarding.performUpdateApp(Onboarding.java:204)
at io.fabric.sdk.android.Onboarding.performUpdateApp(Onboarding.java:194)
at io.fabric.sdk.android.Onboarding.performAutoConfigure(Onboarding.java:175)
at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:112)
at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:45)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
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:762)
Caused by: java.net.ProtocolException: Too many follow-up requests: 21
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:451)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:567)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java)
Anyone already had encountered this error?
This can happen when you strip the API key from Fabric when migrating from Fabric to Firebase Crashlytics, which is not currently supported. When migrating, keep your API key in your project.
Using OkHTTP in my Android app, I have a lot of exception :
EX:
java.lang.AssertionError: libcore.io.ErrnoException: getsockname failed: EBADF (Bad file number)
at libcore.io.IoBridge.getSocketLocalPort(IoBridge.java:649)
at libcore.io.IoBridge.closeSocket(IoBridge.java:202)
at java.net.PlainSocketImpl.close(PlainSocketImpl.java:162)
at ...
Caused by: libcore.io.ErrnoException: getsockname failed: EBADF (Bad file number)
at libcore.io.Posix.getsockname(Posix.java)
at libcore.io.ForwardingOs.getsockname(ForwardingOs.java:69)
at libcore.io.IoBridge.getSocketLocalPort(IoBridge.java:645)
at libcore.io.IoBridge.closeSocket(IoBridge.java:202)
at java.net.PlainSocketImpl.close(PlainSocketImpl.java:162)
at java.net.Socket.close(Socket.java:319)
at ...
I can't catch this error because it's inside the OkHTTP library.
Any solution for me ?
Thanks
I finally discuss with the OkHttp Team, And now the fix is inside the current release !
OkHttp v2.5.0
OkIO v1.6.0
More information here :
https://github.com/square/okhttp/pull/1817
Root cause is a android 4 bug :
https://code.google.com/p/android/issues/detail?id=54072