App.onCreate() is not being called at all in debug builds, but called normally in release builds. I expect it to be called each time I press "Run" button of Android Studio. If I put logs in static{} or onCreate(){} they will not appear in log. Breakpoints also will not be hit. Android Strudio version is 3.5.3 with gradle plugin 3.5.3. This version does not have an "Instant run" feature. Issue also was reproducible in Android Studio 3.5.1. I don't understand why it happened, because few days ago everything was working fine. How to fix this issue? Is it related to the build system or the phone?
App class:
public class App extends Application
{
static
{
System.loadLibrary("some-library-lib");
// Some logic
}
@Override
public void onCreate()
{
super.onCreate();
// Some logic
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my_secret.package">
<uses-permission android:name="android.permission.READ_CONTACTS" />
<!-- Another permissions -->
<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".StartupActivity"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Another activities -->
</application>
</manifest>
I also tried using full-specified App class name in manifest, as:
<application
android:name="com.my_secret.package.App"
But does not make any difference.