Android Question Pls help with this error

ThePuiu

Active Member
Licensed User
Longtime User
I have a pretty big app that working with no problems on several devices (Samsung Tab, Asus Tab and Huawei phones)
After last modification (added a Service to remind once a day to check something) i'we got the error:
B4X:
Logger connected to:  samsung SM-G960F
--------- beginning of main
Copying updated assets files (71)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
[email protected]
** Activity (main) Resume **
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/methods/HttpPost;
    at anywheresoftware.b4a.http.HttpClientWrapper$HttpUriRequestWrapper.InitializePost2(HttpClientWrapper.java:395)
    at anywheresoftware.b4a.samples.httputils2.httpjob._postbytes(httpjob.java:185)
    at anywheresoftware.b4a.samples.httputils2.httpjob._poststring(httpjob.java:233)
    at isorihner.softxxi.main$ResumableSub_VerificaLogin.resume(main.java:1207)
    at isorihner.softxxi.main._verificalogin(main.java:1155)
    at isorihner.softxxi.main$ResumableSub_ButLogin_Click.resume(main.java:1141)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    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)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
    at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1705)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:6986)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.client.methods.HttpPost" on path: DexPathList[[zip file "/data/app/isorihner.softxxi-0G4voQ0v_puPDPuNfxrsfw==/base.apk"],nativeLibraryDirectories=[/data/app/isorihner.softxxi-0G4voQ0v_puPDPuNfxrsfw==/lib/arm64, /system/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    ... 24 more
Service started in the background. Trying to start again in foreground mode.

This error rise ONLY on Samsung S9! I'we tested the app on 2 different phones but result is the same. On Samsung T825 with Android 8, Samsung P6800 with Android 4.1.2 and Asus Zenpad P01Z with Android 5.0.2 working perfectly.
 

DonManfred

Expert
Licensed User
Longtime User
My guess: replace httputils with okhttputils2

you can try to add this to your manifest

B4X:
AddApplicationText(
<uses-library
      android:name="org.apache.http.legacy"
      android:required="false" />
)

PS: Ist does NOT HELP to write a thread PLS HELP WITH THIS ERROR!!
You should write a Threadtitle which matches the problem!
 
Last edited:
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
I apologize for that superficial title... I work for many hours to solve some bugs, including this one...and I'm very tired and frustrated... Unfortunately, neither of the 2 suggestions was helpful.
Worse is that I do not have access to that phone ... the client just tells me that the application is blocked. I'm still trying with Msgbox to display potential errors, then again the client has to reinstall the application and so on.
Any suggestion is welcome!
 
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
The last error message is in attached image.

The server with which the application tries to communicate does not have SSL installed.
 

Attachments

  • error.png
    error.png
    14.8 KB · Views: 146
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
The problem seems to be due to Android 9 ... I upgrade my tablet from 8 to 9 and I hope to find the solution!
 
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
I found that thread and inserted the code in Manifest. Now, the application is no longer running (doesn't start at all after installation) and the Log screen is EMPTY. Manifest file looks like:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
CreateResourceFromFile(Macro, Core.NetworkClearText)

AddPermission(android.permission.CALL_PHONE)
'firebase
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
'firebase end
B4A version 9.5
 
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
thank you Brandsum! Adding SetApplicationAttribute(android:usesCleartextTraffic, "true") in Manifest seems to be the key!
At least, on my Android 9 tablet it seems to work.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top