Android Question HELP! OS reinstall, my apps wont work!

aidymp

Well-Known Member
Licensed User
Longtime User
HI all, Im looking for so help quite fast! as I have to have a show a customer my progress!

I was working with windows 7, using java jdk1.8.0_65 and im not exactly sure what Android Api, as I just install one I feel will work best (I have no idea as to how you would decide which one to use)

I use OKHTTP.

Now I have Windows 8 & java jdk1.8.0_65 and using Api 21, everything is setup and I compile my project, it works until I try either of the following!

B4X:
Dim check As HttpJob
    check.Initialize("checkcredits", Me)   
    check.Download2("http://private.php", Array As String("action","cr","mac", MACaddress))
    check.Release

running the above I get a crash and the log reads

Error occurred on line: 45 (HttpUtils2Service)
java.io.FileNotFoundException: /data/data/com.aidymp.aidymatic/cache/4: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:456)
at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:370)
at com.aidymp.aidymatic.httputils2service._hc_responsesuccess(httputils2service.java:188)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:668)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:334)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:244)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:132)
at anywheresoftware.b4a.BA$3.run(BA.java:334)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
at libcore.io.IoBridge.open(IoBridge.java:442)
... 20 more
** Activity (main) Resume **

This relates to

B4X:
Sub hc_ResponseSuccess (Response As OkHttpResponse, TaskId As Int)
    ' ********** Modified code *************
    Dim cs As CountingOutputStream
   
    
    cs.Initialize(File.OpenOutput(TempFolder, TaskId, False)) ' *******  THIS LINE GIVES THE ERROR!!!
    Dim j As HttpJob = TaskIdToJob.Get(TaskId)
   
    If j.Tag <> Null And j.Tag Is JobTag Then

    Dim jt As JobTag = j.Tag

    jt.CountingStream = cs
    jt.Total = Response.ContentLength
    If jt.Data.url = "" Then
        Log("Job cancelled before downloaded started")
        cs.Close
    End If
    Response.GetAsynchronously("response", cs , _
        True, TaskId)
    '**************************************
    Else
    ' ************* TEST CODE
     Dim job As HttpJob = TaskIdToJob.Get(TaskId)
   job.Tag = Response.StatusCode
   Response.GetAsynchronously("response", File.OpenOutput(TempFolder, TaskId, False), _
     True, TaskId)
    End If
 
End Sub

The next problem is Adsense loads an ad and this causes a crash

main_btn_disclaimer_click (java line: 842)
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/SimpleArrayMap;
at com.google.android.gms.ads.internal.zzq.<init>(Unknown Source)
at com.google.android.gms.ads.internal.zzq.<init>(Unknown Source)
at com.google.android.gms.ads.internal.zzb.<init>(Unknown Source)
at com.google.android.gms.ads.internal.zzc.<init>(Unknown Source)
at com.google.android.gms.ads.internal.zzf.<init>(Unknown Source)
at com.google.android.gms.ads.internal.client.zze.zza(Unknown Source)
at com.google.android.gms.ads.internal.client.zzz.zzdb(Unknown Source)
at com.google.android.gms.ads.internal.client.zzz.zzda(Unknown Source)
at com.google.android.gms.ads.internal.client.zzz.zza(Unknown Source)
at com.google.android.gms.ads.BaseAdView.loadAd(Unknown Source)
at com.google.android.gms.ads.AdView.loadAd(Unknown Source)
at anywheresoftware.b4a.admobwrapper.AdViewWrapper.LoadAd(AdViewWrapper.java:118)
at com.aidymp.aidymatic.main._btn_disclaimer_click(main.java:842)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:78)
at android.view.View.performClick(View.java:4780)
at android.view.View$PerformClick.run(View.java:19866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.SimpleArrayMap" on path: DexPathList[[zip file "/data/app/com.aidymp.aidymatic-2/base.apk"],nativeLibraryDirectories=[/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)
... 29 more
Suppressed: java.lang.ClassNotFoundException: android.support.v4.util.SimpleArrayMap
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)
... 30 more

As I understand it everything is the same! except maybe the API but I have tried a few and its allways the same?

Can someone please help.


Thanks

Aidy
 

sorex

Expert
Licensed User
Longtime User
you should not release the httpjob when you just initate it. Do that in the completion event.
 
Upvote 0

aidymp

Well-Known Member
Licensed User
Longtime User
you should not release the httpjob when you just initate it. Do that in the completion event.

Hi thanks for that, however, the big problem is all the code works or worked perfect prior to reinstalling windows, the error seems to relate to

B4X:
  cs.Initialize(File.OpenOutput(TempFolder, TaskId, False)) ' *******  THIS LINE GIVES THE ERROR!!!


With a folder does not exist error, im certain its down to how I have set up B4A but its really frustrating!

Also Im pretty sure if the problem with admob is solved then this will too.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
hard to tell without seeing more code.

does TempFolder have any value?

use log to verify this
 
Upvote 0

aidymp

Well-Known Member
Licensed User
Longtime User
hard to tell without seeing more code.

does TempFolder have any value?

use log to verify this

Hi sorry for the lack of code, but the app has been working for about 3 months, nothing in the code has changed just reinstallation of windows, I use the same library's folder as its stored on another drive, and java is the same version. I have copied the google-play-services.jar to my libs folder (not really needed as it should be there from before)

The folder TempFolder is defined in

B4X:
Sub Service_Create
    TempFolder = File.DirInternalCache
    hc.Initialize("hc")
    TaskIdToJob.Initialize
End Sub
 
Upvote 0

aidymp

Well-Known Member
Licensed User
Longtime User
Perhaps the title of the post should be changed but I have had a bit of a breakthrough. I was using an emulated device running Api 22 5.1.0
I tried a lower Api 16 4.1.1 and the App works as normal! however Admob is still the same error!
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Perhaps the title of the post should be changed but I have had a bit of a breakthrough. I was using an emulated device running Api 22 5.1.0
I tried a lower Api 16 4.1.1 and the App works as normal! however Admob is still the same error!
Do you have the latest google-services.jar file, if not you should update it and copy that jar file into your additional libraries folder, also your v4 and v7 support files.

Hope this helps!

Cheers,
Walter
 
Upvote 0

aidymp

Well-Known Member
Licensed User
Longtime User
Do you have the latest google-services.jar file, if not you should update it and copy that jar file into your additional libraries folder, also your v4 and v7 support files.

Hope this helps!

Cheers,
Walter

Thanks for this I belive I have the latest google-services.jar but what are the v4 & v7 files i notice my error relates to v4??

Thanks
 
Upvote 0
Top