Parsing Error when install apk

yuhong

Member
Licensed User
Longtime User
B4X:
Case "downloadjob"
      If HttpUtils.IsSuccess(downloadurl) Then 
           src=HttpUtils.GetInputStream(downloadurl)
           'target=File.OpenOutput(File.DirDefaultExternal,"dj.apk",False)' if I use File.DirDefaultExternal then no install error.
           'target=File.OpenOutput(File.DirInternalCache,"dj.apk",False)'
           target=File.OpenOutput(File.DirInternal,"dj.apk",False)
           File.Copy2(src,target)
           target.Flush
           target.Close
           Dim i As Intent
           'i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirDefaultExternal,"dj.apk"))'NO ERROR
           'i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirInternalCache,"dj.apk"))
           i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirInternal,"dj.apk"))'ERROR
           i.SetType("application/vnd.android.package-archive") 
           StartActivity(i)
   End If
when I use File.DirDefaultExternal path,Application can download apk file, then install it,But I use DirInternalCache or dirInternal save file of download file,when install it show "Parsing Error" error!
 
Last edited:

yuhong

Member
Licensed User
Longtime User
The APK file must be in the storage card. Otherwise it is not accessible to the installer.

:BangHead:

For the device without the SD card can not be achieved automatically updated? !For example: Samsung 7500
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
The device may still have some external memory, even if it's not a separate SD Card. On one of my devices I have a NAND partition that would suffice.

Check what File.DirDefaultExternal actually points to.

B4X:
Log(File.DirDefaultExternal)
 
Upvote 0

yuhong

Member
Licensed User
Longtime User
The device may still have some external memory, even if it's not a separate SD Card. On one of my devices I have a NAND partition that would suffice.

Check what File.DirDefaultExternal actually points to.

B4X:
Log(File.DirDefaultExternal)

you are right. program is OK!
thanks!
 
Upvote 0

frevacom

Member
Licensed User
Longtime User
Parsing error

Hi,

My application works fine on my testing device. But when I try to install this on a random device with the apk file I get a parsing error message. I found out that when the B4A Designer application is installed on that device, installing the the app with the apk-file works fine. How to install the app with the APK-file without the B4A Designer application???
 
Upvote 0

frevacom

Member
Licensed User
Longtime User
Thanks for your reply.
I copied the APK on the SD card and selected it in the file explorer.
I don't think it's corrupted. The application works fine on my test device. How can I be sure?
The application is signed with my key.
 
Upvote 0

frevacom

Member
Licensed User
Longtime User
I Compile & Run the project.
In the folder "Objects" I copy the apk file to a SD card. I put the SD card into the Android device and select the apk file.
 
Upvote 0
Top