-1

I have created a simple android project in studio. But it won't run in kitkat and below versions. But it works fine with lollipop+ versions. Each project I create won't run in kitkat. When I open my activity it just stopped on real device but runs properly on emulator. I cant attach my phone to the PC. So I am not able to show the errors in logcat. I tried a lot of things.

Gradle File:

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
    applicationId "com.example.demotoruninpos"
    minSdkVersion 16
    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.3.1'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
}

Manifest file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.demotoruninpos">


<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">

    <activity android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Shuchi Sheth
  • 219
  • 2
  • 13

1 Answers1

2

You are having this problem because of instant run is enable in your android studio. what you have to do ....

go to

File > Setting > Build,Execution,Dev > Instant run > Turn it OFF.  

now you are good to go..Happy Codding

Tejas Pandya
  • 3,987
  • 1
  • 26
  • 51