ASIF RAZA
ASIF RAZA

Reputation: 315

Application crashes by installing APK while running from Android Studio works perfectly

I recently updated Android Studio to 2.3 and SDK to 25. Now when I run application from Android Studio on my mobile or emulator it is working perfectly but when I generate APK or get APK from App and install on device it crashes.

apply plugin: 'com.android.application'
    android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "lovestar.lycamobile"
    minSdkVersion 15
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'

}

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="lovestar.lycamobile">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
    android:allowBackup="true"
    android:icon="@mipmap/lycalogo"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name="lovestar.lycamobile.MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="lovestar.lycamobile.Lyca"></activity>
</application>

Upvotes: 6

Views: 8979

Answers (4)

Generate Signed APk and you will get rid of this problem.

Upvotes: 1

Prashanth
Prashanth

Reputation: 1011

I faced this problem 2-3 days ago. It happens because of Instant Run Feature. Most recent code of App is not properly build on APK So rebuild APK from Android Studio Menu

To solve this:

  1. Use Build APK option from Android Studio Menu and install in Mobile.

If Above Step does nothing See Step 2

  1. Usually it's AndroidManifest.xml problem that does not have proper package name or activity with MAIN intent was not properly defined. That's easy fix.

Upvotes: 4

Prashanth
Prashanth

Reputation: 1011

Possible/Common causes of “Application not Installed” error

  • Insufficient storage space: Your storage space may have filled up with no more space to accommodate new apps.

  • Corrupted app or apk file: This is most common with apps downloaded from outside Google Play Store. The app is either corrupted or incompletely downloaded or copied as the case maybe.

  • Incorrect app install location: Some apps are meant to be only installed on phone memory while some others can be installed on both phone memory and SD card. Trying do otherwise with the former can bring up this errors.

  • Installation on a mounted SD card: Maybe, your SD card is mounted on a laptop or elsewhere. Trying to install anything in this state will result in errors because the SD card is inaccessible.

  • Corrupted storage (Phone and SD card): This is probably the most common cause of this error. If the storage of your device is corrupted, any app installation will be impossible.

  • Apk signature/certificate clash: Installing another version of an app (with a different signed certificate) on the same device will probably result in this error. Installing an unsigned app could also result in this error. App permission errors or temporary OS glitches could also bring about this error.

I think you have not exported the APK in right way that's why you are getting this error.

Upvotes: 2

Artur Bieniek
Artur Bieniek

Reputation: 151

SDK Level 23 means Android 6.0 Marshmallow. Is your mobile's android version really equal to or grater than 6.0? To check this, open Setting app, scroll down, tap Informations, then software info. You'll se your Adnroid version at the top.

Upvotes: -2

Related Questions