My app works fine in Marshmallow and Lollipop versions. But fails to launch in Gingerbread.
This is the error logcat:
E/AndroidRuntime(23029): java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication:
java.lang.ClassNotFoundException: com.android.tools.fd.runtime.BootstrapApplication in loader
dalvik.system.PathClassLoader[/data/app/com.hub.hubcrm-1.apk]
E/AndroidRuntime(23029): Caused by: java.lang.ClassNotFoundException: com.android.tools.fd.runtime.BootstrapApplication in loader
dalvik.system.PathClassLoader[/data/app/com.hub.hubcrm-1.apk]
W/ActivityManager( 295): Force finishing activity
com.convergehub.convergehubcrm/.MainActivity
This is my manifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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:permission="android.permission.READ_PHONE_STATE"
android:protectionLevel="dangerous">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LeadActivity"
android:label="@string/title_activity_lead"
android:theme="@style/AppTheme">
</activity>
</application>
Here is my MainActivity oncreate code :
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d("CHub","Main Activity Started");
ActionBar actionBar = getSupportActionBar();
actionBar.hide();
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.activity_main_webview);
if (isNetworkAvailable(this))
{
Log.d("CHub","Network Available ");
}
else
{
Log.d("Hub","Network Unavailable");
Toast.makeText(getApplicationContext(),"Network unavailable.App will close.",Toast.LENGTH_SHORT).show();
this.finish();
}
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE)!= PackageManager.PERMISSION_GRANTED)
{
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_PHONE_STATE))
{
Log.d("CHub","Already permitted");
}
else
{
Log.d("CHub","Need permission");
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_PHONE_STATE},MY_PERMISSIONS_REQUEST_READ_CONTACTS);
}
}
if(MY_PERMISSIONS_REQUEST_READ_CONTACTS==PackageManager.PERMISSION_GRANTED)
{
Log.d("CHub","PERMISSION_GRANTED");
tm = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
tm.listen(callStateListener, PhoneStateListener.LISTEN_CALL_STATE);
}
else
{
Log.d("CHub","PERMISSION_DENIED");
}
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.setWebViewClient(new MyAppWebViewClient());
mWebView.loadUrl("https://xxx.xxxxxxx.com/");
}
The minimum SDK version is set to 9 and target SDK version is 23. And build tools version is 23.0.3 in the gradle settings.
Why does my app fail to start in the Gingerbread version?