Aditya Singh
Aditya Singh

Reputation: 3

My App not working on Marshmallow but works on Nougat?

I m new to Android development. I have developed an app using the android studio. The problem is that after generating the signed APK, when I m trying to install the app on an android device with MARSHMALLOW on it, it's not getting installed showing error message "APP CANNOT BE INSTALLED" message, but it gets installed on an android device with NOUGAT on it instead I have set minSDKVersion to 19.

Here's my manifest file

    <?xml version="1.0" encoding="utf-8"?>
<manifest
  xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.adityakumarsingh.arduinobot"
  android:versionCode="1"
  android:versionName="1.0">

<uses-sdk
    android:minSdkVersion="19"
    android:targetSdkVersion="26" />

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

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

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".Splash"
        android:screenOrientation="portrait"
        android:theme="@style/SpalshTheme">
    </activity>
    <activity
        android:name=".MainActivity"
        android:screenOrientation="portrait"></activity>
    <activity
        android:name=".Accelerometer"
        android:parentActivityName=".MainActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value=".MainActivity" />
    </activity>
    <activity
        android:name=".BluetoothConnection"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme" />
    <activity
        android:name=".GameMode"
        android:parentActivityName=".MainActivity"
        android:screenOrientation="portrait">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value=".MainActivity" />
    </activity>
    <activity
        android:name=".About"
        android:parentActivityName=".MainActivity"
        android:screenOrientation="portrait">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value=".MainActivity" />
    </activity>
    <activity
        android:name=".Voicerecog"
        android:parentActivityName=".MainActivity"
        android:screenOrientation="portrait">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value=".MainActivity" />
    </activity>
</application>

</manifest>

And here's my build file

    apply plugin: 'com.android.application'

android {
  compileSdkVersion 26
  buildToolsVersion "26.0.2"
  defaultConfig {
      applicationId "com.example.adityakumarsingh.arduinobot"
      minSdkVersion 19
      targetSdkVersion 26
      versionCode 1
      versionName "1.0"
               }

    }

 repositories {
     mavenCentral()
     mavenLocal()
               }

  dependencies {
          implementation fileTree(dir: 'libs', include: ['*.jar'])
          implementation 'com.android.support:appcompat-v7:26.1.0'
          implementation 'com.android.support.constraint:constraint-
          layout:1.0.2'
          compile 'io.github.controlwear:virtualjoystick:1.8.0'
          compile 'com.github.markushi:circlebutton:1.1'
          compile 'de.hdodenhof:circleimageview:2.2.0'
          implementation 'com.android.support:design:26.1.0'
            }

What to do? Any help would be appreciated.Thanks

Upvotes: 0

Views: 2644

Answers (1)

Kushan
Kushan

Reputation: 5984

Ok it mostly is the signature Which is causing issues. Try having a v2 plus v1 signature while signing the apk instead of just any one. I've seen this error when i was just using the v2 method. Adding the v1 signature will help.

V2 signatures sign the module and work for nougat and more. It'll not work on older versions of android so you'll have to use the v1 for full apk signature as well. This will let older versions install it with verification using v1 and nougat and above should still use v2. Use both. Details on this can be found at their site:

https://source.android.com/security/apksigning/v2

Also make sure that there isn't any already installed apk with the same version number as the one you are trying to install. It'll fail if it's already installed and the version number is the same.

Upvotes: 1

Related Questions