B4A Library AppUpdating - automate apps updating from a webserver

Status
Not open for further replies.
Important note: since all the changes made to the Android OS the original code is to be considered outdated. Thanks to @Yayou49 you may find at post#290 a version of the class usable on Android 6+ versions.

Note: version 1.25 breaks existing code so, please, read changelog in post #60 below.


Hi all,

this is my first contributing lib to this great NG.
How do I dare to publish such a low-grade stuff in an area where generally you may find real masterpieces of programming? Well, to be honest, I hope in your help to upgrade my work to a status of "ready-made solution" for those who prefer to run their own webservers where to publish apps.
Secondly, I was asked (both privately and publicly) to overcome my legitimate embarassment and go on with the publication. So, here we are: AppUpdating 1.18!

Note: any valid code fragment comes from some other thread, while all the bad stuff is entirely mine ;-)

Please find attached both the library as is (yes, it works out of the box) and its source code.

On a following post I'm gonna describe the lib in greater detail and show how to use it.

Umberto

AppUpdating version history

* version 1.30 (read notes on post #228)
  • compiled with okHttp 1.01 and okHttpUtils 2.20
  • removed files for version 1.25

* version 1.26 (read notes on post #84)
  • added property WebChangeLog to read optional app's version changelog data
  • better management of versioning in the info file
  • removed files for version 1.18 to avoid confusion (still available on request)
* version 1.25
* version 1.18
  • initial release
 

Attachments

  • AppUpdating_126_ex.zip
    28.3 KB · Views: 1,190
  • AppUpdating_126.zip
    11.3 KB · Views: 1,254
  • AppUpdating_126_src.zip
    10.8 KB · Views: 1,011
  • AppUpdating_130.zip
    11.4 KB · Views: 1,224
  • AppUpdating_130_src.zip
    15.7 KB · Views: 1,137
  • AppUpdating_130_ex.zip
    33.4 KB · Views: 1,347
Last edited:

techknight

Well-Known Member
Licensed User
Longtime User
Hey I never got around to it as it really wasnt causing a problem.

But, the new B4A 6.80 release breaks your library. its completely broken. Error:

B4X:
LogCat connected to: HA0N5DDN
--------- beginning of system
--------- beginning of main
--------- beginning of crash
main_update_updatecomplete (java line: 3639)
java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/Request$Builder;
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest.InitializeGet(OkHttpClientWrapper.java:392)
    at anywheresoftware.b4a.samples.httputils2.httpjob._download(httpjob.java:90)
    at eu.dgconsulting.appupdating.cl_appupdate._readwebvn(cl_appupdate.java:536)
    at md.mdbs03.main._update_updatecomplete(main.java:3639)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:897)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:831)
    at eu.dgconsulting.appupdating.cl_appupdate._finito(cl_appupdate.java:239)
    at eu.dgconsulting.appupdating.cl_appupdate._readcurvn(cl_appupdate.java:504)
    at md.mdbs03.main._vvvvvvvvvvvvv7(main.java:849)
    at md.mdbs03.main._splashtimer_tick(main.java:3613)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.Request$Builder" on path: DexPathList[[zip file "/data/app/md.mdbs03-2/base.apk"],nativeLibraryDirectories=[/data/app/md.mdbs03-2/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 22 more
    Suppressed: java.lang.ClassNotFoundException: okhttp3.Request$Builder
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 23 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
main_update_updatecomplete (java line: 3639)
java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/Request$Builder;
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest.InitializeGet(OkHttpClientWrapper.java:392)
    at anywheresoftware.b4a.samples.httputils2.httpjob._download(httpjob.java:90)
    at eu.dgconsulting.appupdating.cl_appupdate._readwebvn(cl_appupdate.java:536)
    at md.mdbs03.main._update_updatecomplete(main.java:3639)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:897)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:831)
    at eu.dgconsulting.appupdating.cl_appupdate._finito(cl_appupdate.java:239)
    at eu.dgconsulting.appupdating.cl_appupdate._readcurvn(cl_appupdate.java:504)
    at md.mdbs03.main._vvvvvvvvvvvvv7(main.java:849)
    at md.mdbs03.main._splashtimer_tick(main.java:3613)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.Request$Builder" on path: DexPathList[[zip file "/data/app/md.mdbs03-2/base.apk"],nativeLibraryDirectories=[/data/app/md.mdbs03-2/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 22 more
    Suppressed: java.lang.ClassNotFoundException: okhttp3.Request$Builder
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 23 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
main_update_updatecomplete (java line: 3639)
java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/Request$Builder;
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest.InitializeGet(OkHttpClientWrapper.java:392)
    at anywheresoftware.b4a.samples.httputils2.httpjob._download(httpjob.java:90)
    at eu.dgconsulting.appupdating.cl_appupdate._readwebvn(cl_appupdate.java:536)
    at md.mdbs03.main._update_updatecomplete(main.java:3639)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:897)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:831)
    at eu.dgconsulting.appupdating.cl_appupdate._finito(cl_appupdate.java:239)
    at eu.dgconsulting.appupdating.cl_appupdate._readcurvn(cl_appupdate.java:504)
    at md.mdbs03.main._vvvvvvvvvvvvv7(main.java:849)
    at md.mdbs03.main._splashtimer_tick(main.java:3613)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.Request$Builder" on path: DexPathList[[zip file "/data/app/md.mdbs03-2/base.apk"],nativeLibraryDirectories=[/data/app/md.mdbs03-2/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 22 more
    Suppressed: java.lang.ClassNotFoundException: okhttp3.Request$Builder
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 23 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Activity (main) Create, isFirst = true **
Config Version: v2
Expected: v2
** Activity (main) Resume **
** Service (servicemain) Create **
** Service (servicemain) Start **
releasing KeepAlive
No wakelock.
turning screen on
using partialLock
** Service (servicetxrx) Create **
** Service (servicetxrx) Start **
---- AppUpdating.ReadCurVN
UpdateComplete - time: 10:03:04
---- AppUpdating.ReadWebVN
main_update_updatecomplete (java line: 3639)
java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/Request$Builder;
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest.InitializeGet(OkHttpClientWrapper.java:392)
    at anywheresoftware.b4a.samples.httputils2.httpjob._download(httpjob.java:90)
    at eu.dgconsulting.appupdating.cl_appupdate._readwebvn(cl_appupdate.java:536)
    at md.mdbs03.main._update_updatecomplete(main.java:3639)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:897)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:831)
    at eu.dgconsulting.appupdating.cl_appupdate._finito(cl_appupdate.java:239)
    at eu.dgconsulting.appupdating.cl_appupdate._readcurvn(cl_appupdate.java:504)
    at md.mdbs03.main._vvvvvvvvvvvvv7(main.java:849)
    at md.mdbs03.main._splashtimer_tick(main.java:3613)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.Request$Builder" on path: DexPathList[[zip file "/data/app/md.mdbs03-1/base.apk"],nativeLibraryDirectories=[/data/app/md.mdbs03-1/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 22 more
    Suppressed: java.lang.ClassNotFoundException: okhttp3.Request$Builder
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 23 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
main_update_updatecomplete (java line: 3639)
java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/Request$Builder;
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest.InitializeGet(OkHttpClientWrapper.java:392)
    at anywheresoftware.b4a.samples.httputils2.httpjob._download(httpjob.java:90)
    at eu.dgconsulting.appupdating.cl_appupdate._readwebvn(cl_appupdate.java:536)
    at md.mdbs03.main._update_updatecomplete(main.java:3639)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:897)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:831)
    at eu.dgconsulting.appupdating.cl_appupdate._finito(cl_appupdate.java:239)
    at eu.dgconsulting.appupdating.cl_appupdate._readcurvn(cl_appupdate.java:504)
    at md.mdbs03.main._vvvvvvvvvvvvv7(main.java:849)
    at md.mdbs03.main._splashtimer_tick(main.java:3613)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.Request$Builder" on path: DexPathList[[zip file "/data/app/md.mdbs03-1/base.apk"],nativeLibraryDirectories=[/data/app/md.mdbs03-1/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 22 more
    Suppressed: java.lang.ClassNotFoundException: okhttp3.Request$Builder
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 23 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
main_update_updatecomplete (java line: 3639)
java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/Request$Builder;
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest.InitializeGet(OkHttpClientWrapper.java:392)
    at anywheresoftware.b4a.samples.httputils2.httpjob._download(httpjob.java:90)
    at eu.dgconsulting.appupdating.cl_appupdate._readwebvn(cl_appupdate.java:536)
    at md.mdbs03.main._update_updatecomplete(main.java:3639)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:897)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:831)
    at eu.dgconsulting.appupdating.cl_appupdate._finito(cl_appupdate.java:239)
    at eu.dgconsulting.appupdating.cl_appupdate._readcurvn(cl_appupdate.java:504)
    at md.mdbs03.main._vvvvvvvvvvvvv7(main.java:849)
    at md.mdbs03.main._splashtimer_tick(main.java:3613)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.Request$Builder" on path: DexPathList[[zip file "/data/app/md.mdbs03-1/base.apk"],nativeLibraryDirectories=[/data/app/md.mdbs03-1/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 22 more
    Suppressed: java.lang.ClassNotFoundException: okhttp3.Request$Builder
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 23 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
** Service (servicemain) Create **
** Service (servicemain) Start **
releasing KeepAlive
No wakelock.
turning screen on
using partialLock
** Service (servicetxrx) Create **
** Service (servicetxrx) Start **
** Activity (main) Create, isFirst = true **
Config Version: v2
Expected: v2
** Activity (main) Resume **
** Service (servicemain) Start **
releasing KeepAlive
turning screen on
using partialLock
Partial wakeLock already held.
** Service (servicetxrx) Start **
---- AppUpdating.ReadCurVN
UpdateComplete - time: 10:03:21
---- AppUpdating.ReadWebVN
main_update_updatecomplete (java line: 3639)
java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/Request$Builder;
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest.InitializeGet(OkHttpClientWrapper.java:392)
    at anywheresoftware.b4a.samples.httputils2.httpjob._download(httpjob.java:90)
    at eu.dgconsulting.appupdating.cl_appupdate._readwebvn(cl_appupdate.java:536)
    at md.mdbs03.main._update_updatecomplete(main.java:3639)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:897)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:831)
    at eu.dgconsulting.appupdating.cl_appupdate._finito(cl_appupdate.java:239)
    at eu.dgconsulting.appupdating.cl_appupdate._readcurvn(cl_appupdate.java:504)
    at md.mdbs03.main._vvvvvvvvvvvvv7(main.java:849)
    at md.mdbs03.main._splashtimer_tick(main.java:3613)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.Request$Builder" on path: DexPathList[[zip file "/data/app/md.mdbs03-1/base.apk"],nativeLibraryDirectories=[/data/app/md.mdbs03-1/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 22 more
    Suppressed: java.lang.ClassNotFoundException: okhttp3.Request$Builder
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 23 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
main_update_updatecomplete (java line: 3639)
java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/Request$Builder;
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest.InitializeGet(OkHttpClientWrapper.java:392)
    at anywheresoftware.b4a.samples.httputils2.httpjob._download(httpjob.java:90)
    at eu.dgconsulting.appupdating.cl_appupdate._readwebvn(cl_appupdate.java:536)
    at md.mdbs03.main._update_updatecomplete(main.java:3639)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:897)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:831)
    at eu.dgconsulting.appupdating.cl_appupdate._finito(cl_appupdate.java:239)
    at eu.dgconsulting.appupdating.cl_appupdate._readcurvn(cl_appupdate.java:504)
    at md.mdbs03.main._vvvvvvvvvvvvv7(main.java:849)
    at md.mdbs03.main._splashtimer_tick(main.java:3613)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.Request$Builder" on path: DexPathList[[zip file "/data/app/md.mdbs03-1/base.apk"],nativeLibraryDirectories=[/data/app/md.mdbs03-1/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 22 more
    Suppressed: java.lang.ClassNotFoundException: okhttp3.Request$Builder
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 23 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
main_update_updatecomplete (java line: 3639)
java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/Request$Builder;
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest.InitializeGet(OkHttpClientWrapper.java:392)
    at anywheresoftware.b4a.samples.httputils2.httpjob._download(httpjob.java:90)
    at eu.dgconsulting.appupdating.cl_appupdate._readwebvn(cl_appupdate.java:536)
    at md.mdbs03.main._update_updatecomplete(main.java:3639)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:897)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:831)
    at eu.dgconsulting.appupdating.cl_appupdate._finito(cl_appupdate.java:239)
    at eu.dgconsulting.appupdating.cl_appupdate._readcurvn(cl_appupdate.java:504)
    at md.mdbs03.main._vvvvvvvvvvvvv7(main.java:849)
    at md.mdbs03.main._splashtimer_tick(main.java:3613)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.Request$Builder" on path: DexPathList[[zip file "/data/app/md.mdbs03-1/base.apk"],nativeLibraryDirectories=[/data/app/md.mdbs03-1/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 22 more
    Suppressed: java.lang.ClassNotFoundException: okhttp3.Request$Builder
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 23 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
 

udg

Expert
Licensed User
Longtime User
Hi,
please have a look at this thread where Erel explains what goes on and how to fix it.
Currently I am close to deliver a product so I'm not able/inclined to update my BA4 to latest version although I've downloaded it.

udg
 

DonManfred

Expert
Licensed User
Longtime User
so I'm not able/inclined to update my BA4 to latest version
If it is from help:

Attached lib 1.30 compiled with B4A 6.8
 

Attachments

  • AppUpdatingV1.31.zip
    12.5 KB · Views: 401
  • AppUpdatingSRCV1.31.zip
    10.8 KB · Views: 387

udg

Expert
Licensed User
Longtime User
Thanks Manfred. It could have taken me at least a week more.
 

techknight

Well-Known Member
Licensed User
Longtime User
Awesome! I want to make a change to this library, but I have to figure out how to do it which means familiarizing myself with this library.

But lets say your App version currently running its 1.76, and the newest is 1.80, I only want the changelog from 1.76 to newest displayed from the TXT file, nothing earlier.

So if I release 1.80 to 1.81, changelog only shows data between the current running version and the latest, nothing previous. I assume that means adding a VER keyword between each and every version change in the changelog, Time to put my thinking had on. lol.
 

udg

Expert
Licensed User
Longtime User
If you need help understanding my code, just ask and I'll do my best to reply as soon as I read your question.
But lets say your App version currently running its 1.76, and the newest is 1.80, I only want the changelog from 1.76 to newest displayed from the TXT file, nothing earlier.
If I understand it correctly, you're referring to the changelog section added to the data in the TXT file. That is a text you can freely use to convey any kind of information, so it can contains a real, full changelog from version 1.76 to 1.77 all the way up to 1.81 or just notes about version 1.81 only or even other kind of information (not necessarily changelog data).
 
Last edited:

scsjc

Well-Known Member
Licensed User
Longtime User
Hello,
I just found a small problem, very rarely have I received this error and I did not understand.

I think the problem are when android connect to a router or point access that does not have internet return an html from the router itself indicating that there is no internet connection (some routers vodafone have a page with status noconection, or point acces from hotels with a page to pay to get internet)

This page enters through the JOBDONE and gives the error of NumberFormatException ... can anyone confirm this problem? any solution ?

Thank you very much





B4X:
java.lang.NumberFormatException: Invalid double: ""Content-Type" content="text/html; charset=UTF-8" /><meta http-equiv="pragma" content="no-cache" /><meta http-equiv="expires" content="-1" /><meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"/><style type="text/css">body {color: #737373; font-size: 10px; font-family: verdana;}textarea,input,select {background-color: #FDFBFB;border: 1px solid #BBBBBB;padding: 2px;margin: 1px;font-size: 14px;color: #808080;}a, a:link, a:visited, a:active { color: #AAAAAA; text-decoration: none; font-size: 10px; }a:hover { border-bottom: 1px dotted #c1c1c1; color: #AAAAAA; }img {border: none;}td { font-size: 14px; color: #7A7A7A; }</style></head><body>    <form name="sendin" action="http://192.168.4.1/login" method="post">        <input type="hidden" name="username" />        <input type="hidden" name="password" />        <input type="hidden" name="dst" value="http://webwherearenumberversion.com/numberversion.txt" />        <input type="hidden" name="popup" value="true" />    </form>        <script type="text/javascript" src="/md5.js"></script>    <script type="text/javascript">    <!--        function doLogin() {        document.sendin.username.value = document.login.username.value;        document.sendin.password.value = hexMD5('\167' + document.login.password.value + '\045\100\017\057\206\267\145\267\225\203\223\067\006\133\330\077');        document.sendin.submit();        return false;        }    //-->    </script><div align="center"><a href="http://192.168.4.1/login?target=lv&amp;dst=http%3A%2F%2Fwebwherearefiles.com%2Fexe%2Fappupload%2Ffilewithversionnumber.txt">Latviski</a></div><table width="100%" style="margin-top: 10%;">    <tr>    <td align="center" valign="middle">        <div class="notice" style="color: #c1c1c1; font-size: 9px">Please log on to use the internet hotspot service<br /></div><br />        <table width="280" height="280" style="border: 1px solid #cccccc; padding: 0px;" cellpadding="0" cellspacing="0">            <tr>                <td align="center" valign="bottom" height="175" colspan="2">                    <form name="login" action="http://192.168.4.1/login" method="post"                         onSubmit="return doLogin()" >                        <input type="hidden" name="dst" value="http://webwhereareversionnumber.com/versionnumberapp.txt" />                        <input type="hidden" name="popup" value="true" />                                                    <table width="100" style="background-color: #ffffff">                                <tr><td align="right">login</td>                                        <td><input style="width: 80px" name="username" type="text" value=""/></td>                                </tr>                                <tr><td align="right">password</td>                                        <td><input style="width: 80px" name="password" type="password"/></td>                                </tr>                                <tr><td>&nbsp;</td>                                        <td><input type="submit" value="OK" /></td>                                </tr>                            </table>                    </form>                </td>            </tr>            <tr><td align="center"><a href="http://www.mikrotik.com" target="_blank" style="border: none;"><img src="/img/logobottom.png" alt="mikrotik" /></a></td></tr>        </table>        <br /><div style="color: #c1c1c1; font-size: 9px">Powered by MikroTik RouterOS</div>        </td>    </tr></table><script type="text/javascript"><!--  document.login.username.focus();//--></script></body></html>"
    at java.lang.StringToReal.invalidReal(StringToReal.java:63)
    at java.lang.StringToReal.initialParse(StringToReal.java:114)
    at java.lang.StringToReal.parseDouble(StringToReal.java:263)
    at java.lang.Double.parseDouble(Double.java:295)
    at myworldapp.cuentacuentos.com.cl_appupdate._jobdone(cl_appupdate.java:413)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.keywords.Common$5.run(Common.java:996)
    at android.os.Handler.handleCallback(Handler.java:808)
    at android.os.Handler.dispatchMessage(Handler.java:103)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:5299)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
    at dalvik.system.NativeStart.main(Native Method)
 

udg

Expert
Licensed User
Longtime User
Hi, if I understand you correctly, in some circumstances you receive back a valid HTML page (so JobDone is successful) instead of the text file the library expects.
The first workaround that comes to mind is to place a "standard" header in the text file and look for it on a JobDone successful. If it fails this check you know that the page IS NOT the text file you expect.

As an example (untested):
**AppUpdating data file**
Ver=1.23
<ChangeLog>
Version 1.23 is much better than previous one
</ChangeLog>

In your check, you look for "**AppUpdating data file**" that won't be the start of any device provided page..

udg
ps: you could even look for "<!DOCTYPE html>" as the signal for a wrong document, leaving the text file unaltered; maybe this could become standard on next lib's release
 

scsjc

Well-Known Member
Licensed User
Longtime User
Hi, if I understand you correctly, in some circumstances you receive back a valid HTML page (so JobDone is successful) instead of the text file the library expects.
The first workaround that comes to mind is to place a "standard" header in the text file and look for it on a JobDone successful. If it fails this check you know that the page IS NOT the text file you expect.

As an example (untested):
**AppUpdating data file**
Ver=1.23
<ChangeLog>
Version 1.23 is much better than previous one
</ChangeLog>

In your check, you look for "**AppUpdating data file**" that won't be the start of any device provided page..

udg
ps: you could even look for "<!DOCTYPE html>" as the signal for a wrong document, leaving the text file unaltered; maybe this could become standard on next lib's release


Exactly, i think your answer is perfect (before im try a similar) thanks a lot ;)
 

scsjc

Well-Known Member
Licensed User
Longtime User
Hi, if I understand you correctly, in some circumstances you receive back a valid HTML page (so JobDone is successful) instead of the text file the library expects.
The first workaround that comes to mind is to place a "standard" header in the text file and look for it on a JobDone successful. If it fails this check you know that the page IS NOT the text file you expect.

As an example (untested):
**AppUpdating data file**
Ver=1.23
<ChangeLog>
Version 1.23 is much better than previous one
</ChangeLog>

In your check, you look for "**AppUpdating data file**" that won't be the start of any device provided page..

udg
ps: you could even look for "<!DOCTYPE html>" as the signal for a wrong document, leaving the text file unaltered; maybe this could become standard on next lib's release


I try this change... i add:
If Job.GetString.Contains("version=") And Job.GetString.Contains("<ChangeLog>") Then
in -> Case "JobWebVNonly" and Case "JobWebVNcompare"

what you think ??

B4X:
            Case "JobWebVNonly"
                If Job.GetString.Contains("version=") And Job.GetString.Contains("<ChangeLog>") Then
                    If sVerbose Then Log(TAB & "Read while in JobWebVNonly: " & Job.GetString)
                    webver=ExtractVN(Job.GetString)   'Job.GetString.SubString(4)
                    webclog=ExtractCL(Job.GetString)  'optional changelog data
                    If webver = "" Then
                        sStatusCode = ERR_TXTROW
                    Else
                        sStatusCode = OK_WEBVER                    'read apk's version number as published on webserver
                        If sVerbose Then Log(TAB & "Web version number: " & webver)
                    End If
                    Finito
                Else
                    sStatusCode = ERR_TXTROW
                    Finito
                End If
 
Last edited:

udg

Expert
Licensed User
Longtime User
It's ok if you know that alien pages don't contain those references. Probably <ChangeLog> alone will suffice since I doubt an error page could contains it.
Anyway, the check on DOCTYPE seems to me more general because your text file won't be an html page while the error one will .

Here any solution that works for you it's a valid one.
 

Declan

Well-Known Member
Licensed User
Longtime User
I also had this problem.
I use:
B4X:
If IsNumber(apkupdt.WebVN) Then
Been working fine for me now for months
 

scsjc

Well-Known Member
Licensed User
Longtime User
Hello again,
Another problem.... i received this log, with a problem SPACE LEFT ON DEVICE, ...
i think is good idea check space before to process to download no?



B4X:
~e:cl_appupdate_jobdone (java line: 459)
~e:java.io.IOException: write failed: ENOSPC (No space left on device)
~e:    at libcore.io.IoBridge.write(IoBridge.java:499)
~e:    at java.io.FileOutputStream.write(FileOutputStream.java:187)
 
  • Like
Reactions: udg

udg

Expert
Licensed User
Longtime User
check space before to process to download
Absolutely yes. Another good point from you :)
 

techknight

Well-Known Member
Licensed User
Longtime User
Looks like with V7.0.1, I am running into yet another problem which for some reason is absolutely random.

After the influx of AppUpdating requests, (I have a bunch of apps installed with the appupdating library, all seem to be triggered.) I eventually get this SOMETIMES:

B4X:
** Activity (main) Create, isFirst = true **
BrightSet: 160
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Activity (main) Resume **
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
*** Service (servicemain) Create ***
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (servicemain) Start **
releasing KeepAlive
No wakelock.
turning screen on
using partialLock
*** Service (servicetxrx) Create ***
** Service (newinst2) Start **
** Service (servicetxrx) Start **
---- AppUpdating.newinst2: service_started
*** Service (servicescorebird) Create ***
** Service (servicescorebird) Start **
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
java.lang.NoSuchMethodError: anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand
    at eu.dgconsulting.appupdating.newinst2.onStartCommand(newinst2.java:69)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2990)
    at android.app.ActivityThread.access$2200(ActivityThread.java:175)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5602)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
    at dalvik.system.NativeStart.main(Native Method)

Any thoughts?
 

techknight

Well-Known Member
Licensed User
Longtime User
Actually, now its happening every time. So I cant run any of my apps compiled with V7 at this point. :-(

I didnt have any problems at all for the longest time until V6.8 which I stayed away from until V7.0.1
 

techknight

Well-Known Member
Licensed User
Longtime User
I re-compiled the library with the source code provided above just to give it a shot, still hit and miss sometimes, which begs me to ask a question:

Is it possible to have AppUpdating compiled with multiple apps, and all those apps co-existing on the same tablet? I am wondering if that's my issue?
 

udg

Expert
Licensed User
Longtime User
I believe that what you're experiencing is due to the implicit nature of the intent used to wake-up an app compiled with AppUpdating lib.
Since the intent is implicit, every time an app is updated, each of your AppUpdating-based apps will be awakened, then is closed because the intent is not destined to it. Only the right app will execute code for restart.

You could verify the above adding a log in the starting intent section printing the extra data showing the name of the project which was updated. If I'm right, each of your apps should show the same name then terminate.

udg
 

Croïd

Active Member
Licensed User
Longtime User
I do not understand ! Works fine with the apk file but not with the txt file (AppUpdating.ReadWebVN) !

What do I have to do?

B4X:
** Activity (main) Create, isFirst = true **
---- AppUpdating.DownloadApk
---- AppUpdating.ReadCurVN
    Current Version: 1
---- AppUpdating.ReadWebVN
    missing txt file full path indication
   
** Activity (main) Resume **
 
Status
Not open for further replies.
Top