0

I Have started my new android project with Basic Default Activity.IT run fine in emulator .I Have tried to install iy in real device both pre lolipop and abovr lolipop device but getting error App cannot be installed error in prelolipop device and above lolipop device app will install but when i try to open app it will close

Can any one help how to fix this issue ?

Build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.example.myapp.myapplication"
        minSdkVersion 14
        targetSdkVersion 26
        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:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}
Vision Coderz
  • 8,257
  • 5
  • 41
  • 57

2 Answers2

3

Your code is fine, my guess is that your APK is not completely built

Build your APK:

  1. On Android Studio click on Build
  2. Then click on Build APK(s)

After that search for your debug APK and install it on your device

If this fails you can try ADB, take a look at the following guides for install and usage:

Hope it helps

Julio Montoya
  • 1,614
  • 1
  • 12
  • 14
Andre Breton
  • 1,273
  • 1
  • 9
  • 19
0

Two things could be the problem.

  1. Navigate to settings > security and make sure Unknown sources is checked.
  2. Make sure you downloaded the whole apk in the email

Hope this helps!

Appafly
  • 656
  • 2
  • 6
  • 24