Android Question OkHttp v1.01 Error

Pendrush

Well-Known Member
Licensed User
Longtime User
I'm using httputils2service and OkHttp v1.01.
In live application I can see errors on android 5.x device in httputils2service in line job.success = success
Error (obfuscated release):
Attempt to write to field 'boolean com.xxxx.yyyy.httpjob._vvvvvvvvvvvvv5' on a null object reference
All errors come from android 5.x version (SDK 22).
My manifest :<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="19"/>
For release I'm using android.jar 23.
In Google Analytics crash, a lot of errors like (on 4k active app installation)

Stack trace from Google Dev console:

I'm unable to reproduce errors on my devices, also try emulator (Genymotion) without success to reproduce any of these errors.

Can anyone help with errors or workarounds?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Note that the android.jar version used during compilation doesn't have any effect on the actual APK.

Is it possible that you are using the same HttpJob multiple times without dimming it again?

The second error (with the stack trace) means that it failed to open a stream in File.DirInternalCache. Normally it shouldn't happen.

You can try to add File.MakeDir(File.DirInternalCache, "") when your program starts.
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
Is it possible that you are using the same HttpJob multiple times without dimming it again?
I have checked, I'm actually call sub like
B4X:
Private Sub DownX
    Dim job1 As HttpJob
    job1.Initialize("Job1", Me)
    job1.Download("http://www.example.com/down.zip")
    job1.GetRequest.Timeout = 180000
End Sub


The second error (with the stack trace) means that it failed to open a stream in File.DirInternalCache. Normally it shouldn't happen.
my temp folder is
B4X:
TempFolder = File.DirInternal & "/tempdown"
but before download I'm using
B4X:
If File.Exists(File.DirInternal & "/tempdown", "") = False Then
        File.MakeDir(File.DirInternal, "tempdown")
End If
I have same errors in previous app versions, so I have changed from TempFolder = File.DirInternalCache to TempFolder = File.DirInternal & "/tempdown". I have think maybe some cache cleaner cleans automatically downloaded files from cache. But got same error no mater where is temp folder.

EDIT:
I found one place where using job without dimming it.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…