androidandroid-studioapkandroid-manifestioexception

Failed to install app at first time in the device I got java.io.IOException: Failed to load asset path


Everytime I install the app at first time (I mean not installed in device before or when uninstall it and re-install it again) I got this error

E  Failed to open APK '/data/app/~~DMnzdQrGgYoMVn5mnSazHA==/com.mml.dummyapp_kotlin-7QhJglvK4ZbYX3k1LhSksg==/base.apk' I/O error
2022-09-26 16:12:40.817  8427-8606  android.vendin   pid-8427  E  Failed to open APK '/data/app/~~DMnzdQrGgYoMVn5mnSazHA==/com.mml.dummyapp_kotlin-7QhJglvK4ZbYX3k1LhSksg==/base.apk' I/O error
2022-09-26 16:12:40.821  8427-8606  ResourcesManager pid-8427  E  failed to add asset path '/data/app/~~DMnzdQrGgYoMVn5mnSazHA==/com.mml.dummyapp_kotlin-7QhJglvK4ZbYX3k1LhSksg==/base.apk'
java.io.IOException: Failed to load asset path /data/app/~~DMnzdQrGgYoMVn5mnSazHA==/com.mml.dummyapp_kotlin-7QhJglvK4ZbYX3k1LhSksg==/base.apk
 at android.content.res.ApkAssets.nativeLoad(Native Method)
 at android.content.res.ApkAssets.<init>(ApkAssets.java:291)
 at android.content.res.ApkAssets.loadFromPath(ApkAssets.java:140)
 at android.app.ResourcesManager.loadApkAssets(ResourcesManager.java:374)
 at android.app.ResourcesManager.access$000(ResourcesManager.java:67)
 at android.app.ResourcesManager$ApkAssetsSupplier.load(ResourcesManager.java:146)
 at android.app.ResourcesManager.createAssetManager(ResourcesManager.java:451)
 at android.app.ResourcesManager.createResourcesImpl(ResourcesManager.java:538)
 at android.app.ResourcesManager.findOrCreateResourcesImplForKeyLocked(ResourcesManager.java:587)
 at android.app.ResourcesManager.createResources(ResourcesManager.java:866)
 at android.app.ResourcesManager.getResources(ResourcesManager.java:938)
 at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:2225)
 at android.app.ApplicationPackageManager.getResourcesForApplication(ApplicationPackageManager.java:1672)
 at android.app.ApplicationPackageManager.getDrawable(ApplicationPackageManager.java:1437)
 at android.app.ApplicationPackageManager.loadUnbadgedItemIcon(ApplicationPackageManager.java:2950)
 at android.app.ApplicationPackageManager.loadItemIcon(ApplicationPackageManager.java:2929)
 at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:271)
 at android.app.ApplicationPackageManager.getApplicationIcon(ApplicationPackageManager.java:1501)
 at fva.a(PG:5)
 at fvg.l(PG:1)
 at qt.aci(PG:46)
 at fuj.k(PG:3)
 at fua.f(PG:3)
 at fua.i(PG:3)
 at fve.i(Unknown Source:0)
 at fvh.d(Unknown Source:10)
 at fvh.e(PG:3)
 at ftr.apply(PG:168)
 at ahmn.e(PG:2)
 at ahmo.run(PG:9)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
 at jjd.run(PG:17)
 at java.lang.Thread.run(Thread.java:923)
2022-09-26 16:14:08.111 13577-13577 studio.deploy  pid-13577   E  InstallClient: Could not copy '/data/local/tmp/.studio/tmp/31c79e06/install_server' to '/data/data/com.mml.dummyapp_kotlin/code_cache/install_server-31c79e06: out='', err='run-as: unknown package: com.mml.dummyapp_kotlin
run-as: unknown package: com.mml.dummyapp_kotlin                     '
2022-09-26 16:14:08.129 13577-13577 studio.deploy  pid-13577     E  run-as: unknown package: com.mml.dummyapp_kotlin
2022-09-26 16:14:08.158 13577-13577 studio.deploy  pid-13577     E  Could not get package user id: run-as: unknown package: com.mml.dummyapp_kotlin
2022-09-26 16:14:08.181 13577-13577 studio.deploy  pid-13577     E  Could not find apks for this package: com.mml.dummyapp_kotlin

manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application
        android:name=".BaseApplication"
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:hardwareAccelerated="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="false"
        android:theme="@style/Theme.DummyAppKotlin"
        android:usesCleartextTraffic="true"
        tools:targetApi="33">
        <activity android:name=".ui.DetailsActivity" />
        <activity
            android:name=".ui.MainActivity"
            android:configChanges="orientation|screenSize"
            android:exported="true">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <service
            android:name="com.mml.dummyapp_kotlin.util.MyFirebaseMessagingService"
            android:enabled="true"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
        <!--
 Set custom default icon. This is used when no icon is set for incoming notification messages.

        -->
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/activity_feed" />

        <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-6982469603053718~7540735179" />

    </application>

</manifest>

then when I open the app menu it works normally


Solution

  • Okay I didn't find the reason for this error but the following steps helped me to fix it

    1. I followed the steps in this answer to completely uninstall AS

    2. I also found that I used two versions of ADB that's maybe causing conflicts when installing apps, so I decided to uninstall both (then install the newest one that is included with android studio)

    Note: the older ADB path was in %SystemDrive%\adb

    1. After restarting the windows I installed a fresh version of AS

    enter image description here