Android Question Target SDK 28/29 NoClassDefFound

MotoMusher

Active Member
Licensed User
Longtime User
This was (and is) fine under target=27. I need to publish an update and Play is forcing SDK 29 now.

When I open one of my activities (others are fine), I get the following:

JobName = jobAuth, Success = true
** Activity (main) Pause, UserClosed = false **
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/impl/client/DefaultHttpClient;
at xvs.ACL.ACL.<init>(ACL.java:85)
at java.lang.Class.newInstance(Native Method)
at anywheresoftware.b4a.shell.Shell.createObject(Shell.java:612)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:366)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
...
Caused by: java.lang.ClassNotFoundException: org.apache.http.impl.client.DefaultHttpClient


Any ideas on how to resolve? I'll post updates as I find them. When I switch manifest back to 27 it works just fine.
 

MotoMusher

Active Member
Licensed User
Longtime User
I appear to have/had a couple issues. I haven't changed SDK in a while.

Android.jar was pointing to sdk27. I moved that to 29 in paths configuration

I was using the httputils service from long ago as a file in my project. I pulled the httpjob and httputilsservice from the project (just renamed for now) and replaced with references to OK.

Most validates now, but I had made heavy use of PutFile in httpjob

What's the recommended workaround for that in OK?

B4X:
Public Sub PutFile(Link As String, Dir As String, FileName As String)
    Dim length As Int
    If Dir = File.DirAssets Then
        Log("Cannot send files from the assets folder.")
        Return
    End If
    length = File.Size(Dir, FileName)
    Dim In As InputStream
    In = File.OpenInput(Dir, FileName)
    req.InitializePut(Link, In, length)
    CallSubDelayed2(HttpUtils2Service, "SubmitJob", Me)   
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…