Android Question

Apk installs but won't start only on Android 4

My application works fine on Android 4, 5 and 6, when I plug devices to computer. But when I get .apk file from app/build/outputs/apk directory and install it directly, application crashes on Android 4 on start. Only on Android 4. Why? And how to fix it?

Here is my manifest file:

<manifest package="ru.pussy_penetrator.chgk"
xmlns:android="http://schemas.android.com/apk/res/android">

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

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

<activity
android:name=".QuestionGridActivity"/>

<activity
android:name=".QuestionPagerActivity"/>

</application>



Answer

Disable the Instant Run and Build the APK. Instant Run uses the device cache to hot swap the changes you make in the project. Also it optimizes the code to run on the platform that your testing device has.

You can also generate Signed apk for distributing across all the supported Android versions