Can't install apk in one phone

When I try to install apk on 5 different mobile phones, one of them panics. The other 4 are working fine. Here is the error information:

  • android.content.pm.PackageParser $ PackageParserException: Failed to add resource path

  • java.lang.SecurityException: getDeviceId: neither user 10071 nor the current process has android.permission.READ_PHONE_STATE

Below is the detailed error:

04-07 12:10:06.788 9371-9371/? W/zipro: Error opening archive /storage/6365-3066/Download/qqmail/ISCAN-debug.apk: Invalid file
04-07 12:10:06.789 9371-9371/? E/PackageUtil: can not parse packag
                                          android.content.pm.PackageParser$PackageParserException: Failed adding asset path: /storage/6365-3066/Download/qqmail/ISCAN-debug.apk
                                              at android.content.pm.PackageParser.loadApkIntoAssetManager(PackageParser.java:898)
                                              at android.content.pm.PackageParser.parseBaseApk(PackageParser.java:926)
                                              at android.content.pm.PackageParser.parseMonolithicPackage(PackageParser.java:874)
                                              at android.content.pm.PackageParser.parseMonolithicPackage(PackageParser.java:855)
                                              at com.android.packageinstaller.PackageUtil.getPackageInfo(PackageUtil.java:79)
                                              at com.android.packageinstaller.PackageInstallerActivity.onCreate(PackageInstallerActivity.java:728)
                                              at android.app.Activity.performCreate(Activity.java:6367)
                                              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2397)
                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2504)
                                              at android.app.ActivityThread.access$900(ActivityThread.java:165)
                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)
                                              at android.os.Handler.dispatchMessage(Handler.java:102)
                                              at android.os.Looper.loop(Looper.java:150)
                                              at android.app.ActivityThread.main(ActivityThread.java:5546)
                                              at java.lang.reflect.Method.invoke(Native Method)
                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:682)
04-07 12:10:06.789 9371-9371/? W/PackageInstaller: Parse error when parsing manifest. Discontinuing installation
04-07 12:10:06.794 3635-3635/? I/WindowBlurViewManager: allowChangeBlurBackground
04-07 12:10:06.818 4402-4163/? W/System.err: java.lang.SecurityException: getDeviceId: Neither user 10071 nor current process has android.permission.READ_PHONE_STATE.
04-07 12:10:06.818 4402-4163/? W/System.err:     at android.app.ContextImpl.enforce(ContextImpl.java:1595)
04-07 12:10:06.818 4402-4163/? W/System.err:     at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1627)
04-07 12:10:06.818 4402-4163/? W/System.err:     at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:675)
04-07 12:10:06.818 4402-4163/? W/System.err:     at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:675)
04-07 12:10:06.818 4402-4163/? W/System.err:     at com.android.internal.telephony.HwPhoneService.canReadPhoneState(HwPhoneService.java:969)
04-07 12:10:06.818 4402-4163/? W/System.err:     at com.android.internal.telephony.HwPhoneService.getUniqueDeviceId(HwPhoneService.java:984)
04-07 12:10:06.818 4402-4163/? W/System.err:     at com.android.internal.telephony.IHwTelephony$Stub.onTransact(IHwTelephony.java:364)
04-07 12:10:06.818 4402-4163/? W/System.err:     at android.os.Binder.execTransact(Binder.java:453)
04-07 12:10:06.819 9371-9392/? W/System.err: java.lang.SecurityException: getDeviceId: Neither user 10071 nor current process has android.permission.READ_PHONE_STATE.
04-07 12:10:06.819 9371-9392/? W/System.err:     at android.os.Parcel.readException(Parcel.java:1602)
04-07 12:10:06.820 9371-9392/? W/System.err:     at android.os.Parcel.readException(Parcel.java:1555)
04-07 12:10:06.820 9371-9392/? W/System.err:     at com.android.internal.telephony.IHwTelephony$Stub$Proxy.getUniqueDeviceId(IHwTelephony.java:1297)
04-07 12:10:06.820 9371-9392/? W/System.err:     at android.telephony.HwTelephonyManagerInner.getUniqueDeviceId(HwTelephonyManagerInner.java:843)
04-07 12:10:06.820 9371-9392/? W/System.err:     at android.telephony.HwInnerTelephonyManagerImpl.getUniqueDeviceId(HwInnerTelephonyManagerImpl.java:340)
04-07 12:10:06.820 9371-9392/? W/System.err:     at android.telephony.TelephonyManager.getDeviceId(TelephonyManager.java:723)
04-07 12:10:06.820 9371-9392/? W/System.err:     at com.hianalytics.android.v1.e.a(Unknown Source)
04-07 12:10:06.820 9371-9392/? W/System.err:     at com.hianalytics.android.v1.e.run(Unknown Source)
04-07 12:10:06.820 9371-9392/? W/System.err:     at android.os.Handler.handleCallback(Handler.java:743)
04-07 12:10:06.820 9371-9392/? W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
04-07 12:10:06.820 9371-9392/? W/System.err:     at android.os.Looper.loop(Looper.java:150)
04-07 12:10:06.820 9371-9392/? W/System.err:     at android.os.HandlerThread.run(HandlerThread.java:61)

      

Any idea why this is only happening on this phone? How to fix it? Thank.

+3


source to share


2 answers


04-07 12: 10: 06.788 9371-9371 /? W / zipro: Error opening archive / storage / 6365-3066 / Download / qqmail / ISCAN-debug.apk: Invalid file

This is problem.

According to Android source , the return code is kInvalidFile

reported in several places:



  • The archive (APK file) cannot be memory-mapped because the file is too large, too small, or inaccessible.
  • There is something wrong with the End of Central Directory (EOCD) data in the APK file.

I'm guessing there is something wrong with accessing the APK at this /storage/...

location. Try to transfer the APK to the regular Android temp directory - /data/local/tmp/

.

Otherwise, there is some corruption of the APK itself or some other software (antivirus, anti-malware, etc.) to stop accessing the file.

0


source


This is because perhaps you are not giving self-defense rights to the marshmallow ... try this:

ActivityCompat.requestPermissions(MainActivity.this,
            new String[]{Manifest.permission.READ_PHONE_STATE,Manifest.permission.READ_PHONE_STATE},
            1);

      

or use it as shown in your oncreate screen:



if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
            if(ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED){
                requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE},100);
                return;
            }
        }

      

then use this method:

 @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    if(requestCode == 100 && (grantResults[0] == PackageManager.PERMISSION_GRANTED)){
        pick_file();
    }else {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE},100);
        }
    }
}

      

0


source







All Articles