我的应用程序在Marshmallow和Lollipop版本中运行良好。但未能在Gingerbread中推出。
这是错误logcat:
E / AndroidRuntime(23029):java.lang.RuntimeException:无法执行 实例化应用程序 com.android.tools.fd.runtime.BootstrapApplication:
抛出java.lang.ClassNotFoundException: com.android.tools.fd.runtime.BootstrapApplication在装载机中 dalvik.system.PathClassLoader [/data/app/com.hub.hubcrm-1.apk]
E / AndroidRuntime(23029):引起:java.lang.ClassNotFoundException: com.android.tools.fd.runtime.BootstrapApplication在装载机中 dalvik.system.PathClassLoader [/data/app/com.hub.hubcrm-1.apk]
W / ActivityManager(295):强制完成活动
com.convergehub.convergehubcrm / .MainActivity
这是我的清单
<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>
这是我的MainActivity oncreate代码:
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/");
}
最低SDK版本设置为9,目标SDK版本为23.并且在gradle设置中构建工具版本为23.0.3。
为什么我的应用无法启动Gingerbread版本?