0

Instant app working FINE while run the app from android studio but, getting errors while generate the APK build and try to run it from device getting below error in xiaomi noughat device instant app crash by giving this message "There was a problem parsing the package" I have used instant app development version 1.3.0 and also enabled instant app setting from settings > google > instant apps

E/Icon: Unable to load resource 0x00000000 from pkg=com.android.systemui
android.content.res.Resources$NotFoundException: Resource ID #0x0
    at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:201)
    at android.content.res.MiuiResourcesImpl.getValue(MiuiResourcesImpl.java:91)
    at android.content.res.Resources.getDrawable(Resources.java:784)
    at android.graphics.drawable.Icon.loadDrawableInner(Icon.java:316)
    at android.graphics.drawable.Icon.loadDrawable(Icon.java:272)
    at android.graphics.drawable.Icon.loadDrawableAsUser(Icon.java:380)
    at com.android.systemui.statusbar.ExpandedIcon.getDrawable(ExpandedIcon.java:59)
    at com.android.systemui.statusbar.StatusBarIconView.getIcon(StatusBarIconView.java:174)
    at com.android.systemui.statusbar.StatusBarIconView.setIcon(StatusBarIconView.java:133)
    at com.android.systemui.statusbar.StatusBarIconView.updateDarkMode(StatusBarIconView.java:266)
    at com.android.systemui.statusbar.phone.SimpleStatusBar.updateDarkMode(SimpleStatusBar.java:264)
    at com.android.systemui.statusbar.phone.PhoneStatusBar$17.run(PhoneStatusBar.java:3494)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6195)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:874)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:764)

and getting below error in lollipop device

package - Android: Parse error when parsing manifest. Discontinuing installation

Here i listed out manifest files and gradle files of my project

instantapp gradle

apply plugin: 'com.android.instantapp'
dependencies {
implementation project(':feature')
implementation project(':base')}

feature module gradle and manifest

apply plugin: 'com.android.feature'
    android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':base')
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myfirstinstantapp.feature">
<uses-permission android:name="android.permission.INTERNET" />
<application>
    <activity android:name="com.example.myfirstinstantapp.feature.MainActivity">
        <meta-data
            android:name="default-url"
            android:value="https://myfirstinstantapp.example.com/hello" />

        <intent-filter android:order="1">
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />

            <data
                android:host="myfirstinstantapp.example.com"
                android:pathPattern="/.*"
                android:scheme="https" />
        </intent-filter>

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

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

===========================================

base module gradle and manifest

apply plugin: 'com.android.feature'
android {
    compileSdkVersion 28
    baseFeature true
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    api 'com.android.support:appcompat-v7:28.0.0-alpha3'
    api 'com.android.support.constraint:constraint-layout:1.1.2'
    application project(':app')
    feature project(':feature')
}


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myfirstinstantapp">
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity" />
    </application>
</manifest>

===========================================

app gradle and manifest

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.myfirstinstantapp.app"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"


    }
    buildTypes {
       release {
           minifyEnabled false
           proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
       }
    }

}
dependencies {
    implementation project(':feature')
    implementation project(':base')
}

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myfirstinstantapp.app" />

===========================================

project level gradle

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Here i attached screenshot of my project structure

enter image description here

prachi patel
  • 51
  • 1
  • 5
  • do any of these help you? https://stackoverflow.com/questions/18492004/signed-apk-parse-error-when-parsing-manifest or https://stackoverflow.com/questions/12716715/inconsistent-parsing-error-when-trying-to-install-an-unsigned-remote-apk-file – TWL Jun 25 '18 at 21:43
  • And as for manually installing the IA apk's, you should be doing this: https://stackoverflow.com/a/50935237/6668797 – TWL Jun 25 '18 at 21:44
  • Hi @TWL I go 2 APks while generate the build for instantapp module and got 1 APK while generate the build for APP module -for instantapp module 1) base debug apk and 2)feature debug apk and -for app module 1)App debug apk I am trying to install that feature apk from my device... base Apk installed fine i got this issue while i m trying to install feature APK... is it possible to install feature APK? – prachi patel Jun 27 '18 at 13:00
  • Yes, your project will produce two apk's in a zipped file, you run the install cmd with that zip, don't unzip it. It sounds like you are trying to install the ia apk's one by one? That's not correct. If you follow the instruction @ https://stackoverflow.com/a/50935237/6668797, you install IA zip, not as apk's. – TWL Jun 27 '18 at 16:16
  • Hi @TWL if i follow the @ stackoverflow.com/a/50935237/6668797 instructions which APK will be used for instant app from zip file. in zip folder i have 2 apks base and feaure if i run zip file from cmd which apk will be used for instant app base or feature? – prachi patel Jun 28 '18 at 04:03
  • and my base debug apk size is 36 MB around and feature apk size is 10.4 KB and total instant app zip file size is 33.4 MB .. my base module contains my whole project code and feature module i have set only one activity. is it possible to install instant app zip file ? because instant app require Max 4 MB size limit.Could you please help me to clear my confusion. – prachi patel Jun 28 '18 at 04:53
  • If you run that ia cmd, it will install all of the ia-apks. The install cmd doesn't perform any checks like this, there is another command that will simulate the playstore upload checks: `ia check` Sure, you can build a project that exceeds the size, but you simply won't be able to publish it. – TWL Jun 28 '18 at 15:55
  • Hi @TWL I have split my code in various 6 modules and still my base module contains 34 MB, in instant app zip file base apk contain 34 MB and that feature modules are about to 2 MB around now how can i able to publish my instant app? – prachi patel Jul 02 '18 at 12:33
  • in short is it possible to publish instant app for big projects? because my base module size cant be reduce anymore now. i tried to reduce base module size by converting to various features modules but still have base module size issue – prachi patel Jul 02 '18 at 12:39
  • and without implementation of base module in instant app gradle i can't the build instant app gradle successfully now what to do. could you please help me? – prachi patel Jul 02 '18 at 13:16
  • There is a beta program for 10mb max https://g.co/instantapps/10MB but you are still way over. The general way to calculate your total size is base + feature. For more details, see https://developer.android.com/topic/google-play-instant/guides/reduce-module-size – TWL Jul 02 '18 at 23:39

0 Answers0