Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>

like image 725
ASIF RAZA Avatar asked Mar 20 '17 07:03

ASIF RAZA


People also ask

Why does my app crashes everytime I open it in Android Studio?

An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java or Kotlin crashes if it throws an unhandled exception, represented by the Throwable class.

How do you fix an app that keeps crashing on Android Studio?

The easiest way to fix an app that keeps crashing on your Android smartphone is to simply force stop it and open it again. To do this, go to Settings -> Apps and select the app that keeps crashing. Tap on the app's name and then tap on 'Force stop'. Now try opening the app again and see if it works well.

Why does my APK app keep crashing?

Apps on Android can crash because of low storage space, too many apps running simultaneously, a weak internet connection, or not having the proper app updates installed.

Why do certain apps keep crashing on my Android?

This usually occurs when your Wi-Fi or cellular data is slow or unstable, causing apps to malfunction. Another reason for Android apps crashing can be a lack of storage space in your device. This can occur when you overload your device's internal memory with heavy apps.


1 Answers

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.
like image 55
Prashanth Avatar answered Sep 27 '22 23:09

Prashanth