0

I've made a WebView based app that is being installed on some devices, while not being installed in others. I've checked it on android version 4, 6, 7. The problem is not with the Android version. In some devices, it says Problem occurs when parsing the package or Application package installer has stopped unexpectedly.

Note: I've got problems in Samsung j7 Prime, Mi A1, and some others. But no problem in Mi Note 3, Oppo f3 and some others.

What am I doing wrong? This is my activity_main.xml:

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

    <im.delight.android.webview.AdvancedWebView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context="com.example.MainActivity"
        android:id="@+id/webview">
    </im.delight.android.webview.AdvancedWebView>

    <com.google.android.gms.ads.AdView
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        ads:adSize="BANNER"
        ads:adUnitId="id">
    </com.google.android.gms.ads.AdView>

</RelativeLayout>

And this is my AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

And this is my build.gradle:

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.8.1'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

repositories {
    maven { url 'https://maven.google.com' }
}

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.rimikri.smartpedi"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        //OneSignal
        manifestPlaceholders = [
                onesignal_app_id: 'id',
                onesignal_google_project_number: 'REMOTE'
        ]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    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'
    compile 'com.onesignal:OneSignal:[3.8.3, 3.99.99]'
    compile 'com.github.delight-im:Android-AdvancedWebView:v3.0.0'
    compile 'com.google.firebase:firebase-core:15.0.2'
    implementation 'com.google.android.gms:play-services-ads:15.0.0'
    compile 'com.google.firebase:firebase-ads:15.0.0'
    implementation 'com.facebook.android:audience-network-sdk:4.27.1'
    implementation 'com.google.ads.mediation:facebook:4.27.1.0'
}

apply plugin: 'com.google.gms.google-services'

Thanks in advance for the suggestion.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Ashonko
  • 533
  • 8
  • 34

4 Answers4

0

It is mainly due to different android versions,

try defining your minimum and target android API level in the manifest.xml

e.g.

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="27" />
akash
  • 587
  • 4
  • 16
0

your minimum sdk level is 21 minSdkVersion 21

Do you have a view component that only supports Android 5.0 (LOLLIPOP) and above possibly? You should run Analyze code and check xml errors that doesn't cause any runtime errors

Also, Do you use any 3rd party libraries? Some of them may have minSdk version specified and they can be lower than your app's minSdk

Ege Kuzubasioglu
  • 5,991
  • 12
  • 49
  • 85
  • I'm using [AdvancedWebView](https://github.com/delight-im/Android-AdvancedWebView/) as the WebView component. And an AdMob component. Nothing else. – Ashonko May 30 '18 at 11:35
0

This might be because of you are trying to install application on the devices having API level below 21 (i.e. Lollipop) and your app having minSdkVersion = "21". So for using app on the devices below api level 21 downgrade your app's minSdkVersion to 16 (minSdkVersion = "16") in your app level build.gradle file.

0

since it works with some devices and does not work with others im pretty sure it's a size problem , you have put an image or an icon somewhere and it is not suitable for some devices size

evals
  • 1,750
  • 2
  • 18
  • 28