0

I am building an app with system level privileges and got it signed by the mobile manufacturer.

The signed apk generated is getting installed, but when I try to open the app from menu, it says Application is not installed.

Below is the manifest file of the app. Any suggestions are welcome

<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.mjawaid.nwlogger"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:sharedUserId="android.uid.system">

<!-- <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/> -->
<!-- <uses-permission android:name="android.permission.WRITE_SETTINGS"/> -->
<!-- <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL"/>
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> -->

<!--<uses-feature android:name="android.hardware.telephony">
</uses-feature> -->

<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"
    android:sharedUserId="android.uid.system">
    <activity
        android:name="com.mjawaid.nwlogger.MainActivity"
        android:exported="false">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <activity android:name="com.mjawaid.nwlogger.NWOptionsActivity"/>
    <activity android:name="com.mjawaid.nwlogger.helper.silentlog.SilentLogSprdOption">
    </activity>
</application>

Below is the app build.gradle, if this helps.

apply plugin: 'com.android.application' 
android {
compileSdkVersion 27
signingConfigs {
    config {
        storeFile file("test.keystore")
        storePassword "xxxxxx"
        keyAlias "xxxxxx"
        keyPassword "xxxxxx"
    }
}

defaultConfig {
    applicationId "com.mjawaid.nwlogger"
    minSdkVersion 22
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    signingConfig signingConfigs.config
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        debuggable false
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.config
        android.applicationVariants.all { variant ->
            variant.outputs.all {
                outputFileName = "NWLogger-vRel.apk"
            }
        }

        /*applicationVariants.all { variant ->
            variant.outputs.each { output ->
                output.outputFileName = new File(output.outputFileName.parent,
                        output.outputFileName.name.replace("app-release", "NWLogger")
                        //for Debug use output.outputFile = new File(output.outputFile.parent,
                        //                             output.outputFile.name.replace("-debug", "-" + formattedDate)
                )
            }
        }*/
    }
    debug {
        debuggable false
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.config

        android.applicationVariants.all { variant ->
            variant.outputs.all {
                outputFileName = "NWLogger-vDebug.apk"
            }
        }

        /*applicationVariants.all { variant ->
            variant.outputs.each { output ->
                output.outputFileName = new File(output.outputFileName.parent,
                        output.outputFileName.name.replace("app-debug", "BTStabilityTest")
                        //for Debug use output.outputFile = new File(output.outputFile.parent,
                        //                             output.outputFile.name.replace("-debug", "-" + formattedDate)
                )
            }
        }*/
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
}
Ashhar Jawaid
  • 132
  • 1
  • 8

3 Answers3

0

if you have root access then try to put the app inside /system/priv-app manually then reboot your device and try to open from menu.

Arpan Sarkar
  • 2,301
  • 2
  • 13
  • 24
  • sorry no root access available. But as the apk is signed the manufacturer itself, i think i got that permission. Also is there any permission i need to take ? – Ashhar Jawaid Feb 06 '18 at 12:36
  • your device run on which version of Android? – Arpan Sarkar Feb 06 '18 at 12:42
  • refer to the link https://stackoverflow.com/questions/4226132/app-not-installed-error-on-android – Arpan Sarkar Feb 06 '18 at 12:54
  • Android 7.0 . The link you shared is for a different issue. There the app itself is not getting installed but was working fine with emulator. Here it is getting installed like any normal apk does, but on clicking the startup icon in the menu, it gives a popup that application is not installed. – Ashhar Jawaid Feb 06 '18 at 13:24
0

Try to clean build and then you need to create signed apk.

Ankit Mehta
  • 4,251
  • 4
  • 19
  • 27
0

It seems the error was due to the fact the I added android:exported="false" to my launcher activity which seems to have causing the problem.

Removing the attribute solved my problem.

Ashhar Jawaid
  • 132
  • 1
  • 8