電話を起動したときにアプリがクラッシュする理由について、私は完全に混乱しています。
私のAndroidManifest.xml
:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.callmenew"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.USE_SIP" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-feature android:name="android.hardware.sip.voip" />
<uses-feature android:name="android.hardware.wifi" />
<uses-feature android:name="android.hardware.microphone" />
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15" />
<application android:label="@string/app_name" android:theme="@style/AppTheme" android:icon="@drawable/appslogo">
<service android:name=".MService"/>
<activity android:name=".Login">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".searchcall" android:screenOrientation="portrait"/>
<activity android:name=".SoftwarePassionView" android:screenOrientation="portrait"/>
<activity android:name=".MainActivity" android:screenOrientation="portrait"/>
<activity android:name=".outcall" android:screenOrientation="portrait"/>
<receiver android:name=".IncomingCallReceiver" android:label="Call Receiver" android:screenOrientation="portrait"/>
<receiver android:name="com.callmenew.MyBroadcastReceiver" android:enabled="true" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<activity android:name=".incomingcallevent" android:screenOrientation="portrait"/>
<activity android:name=".city" android:noHistory="true" android:label="City" android:screenOrientation="portrait"/>
<activity android:name=".createAd" android:label="Create Your Advertisement" android:screenOrientation="portrait"/>
<activity android:name=".rgtrUser1" android:label="Create Your Account" android:screenOrientation="portrait"/>
</application>
私のMyBroadcastreceiver
:
public class MyBroadcastreceiver extends BroadcastReceiver {
@Override
public void onReceive(Context arg0, Intent arg1) {
// Intent startServiceIntent = new Intent(arg0, searchcall.class);
// startServiceIntent.putExtra("starts", "starts");
// startServiceIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// arg0.startActivity(startServiceIntent);
Toast.makeText(arg0.getApplicationContext(), "start", Toast.LENGTH_LONG).show();
}
}
myservice クラス:-
@Override
public void onCreate() {
super.onCreate();
Toast.makeText(this, "Service created...", Toast.LENGTH_LONG).show();
Log.i(tag, "Service created...");
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
Toast.makeText(this, "Debug: SyncService onStartCommand", Toast.LENGTH_LONG).show();
SharedPreferences settings = getSharedPreferences("calldata", Context.MODE_PRIVATE);
sipAddress = settings.getString("sipAddress", "");
// sipAddress= intent.getStringExtra("sipaddress");
// sipcallid = intent.getStringExtra("sipAddress");
Toast.makeText(MService.this, "sipAddress = "+sipAddress+" sipcallid ="+sipcallid, Toast.LENGTH_LONG).show();
IntentFilter filter2 = new IntentFilter();
filter2.addAction("android.SipDemo.INCOMING_CALL");
callReceiver2 = new IncomingCallReceiver();
this.registerReceiver(callReceiver2, filter2);
initializeManager(sipAddress);
return START_STICKY;
}
丸太の猫:-
04-20 16:58:46.179: E/AndroidRuntime(294): FATAL EXCEPTION: main
04-20 16:58:46.179: E/AndroidRuntime(294): java.lang.RuntimeException: Unable to instantiate receiver com.callmenew.MyBroadcastReceiver: java.lang.ClassNotFoundException: com.callmenew.MyBroadcastReceiver
04-20 16:58:46.179: E/AndroidRuntime(294): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2100)
04-20 16:58:46.179: E/AndroidRuntime(294): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
04-20 16:58:46.179: E/AndroidRuntime(294): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1197)
04-20 16:58:46.179: E/AndroidRuntime(294): at android.os.Handler.dispatchMessage(Handler.java:99)
04-20 16:58:46.179: E/AndroidRuntime(294): at android.os.Looper.loop(Looper.java:137)
04-20 16:58:46.179: E/AndroidRuntime(294): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-20 16:58:46.179: E/AndroidRuntime(294): at java.lang.reflect.Method.invokeNative(Native Method)
04-20 16:58:46.179: E/AndroidRuntime(294): at java.lang.reflect.Method.invoke(Method.java:511)
04-20 16:58:46.179: E/AndroidRuntime(294): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-20 16:58:46.179: E/AndroidRuntime(294): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-20 16:58:46.179: E/AndroidRuntime(294): at dalvik.system.NativeStart.main(Native Method)
04-20 16:58:46.179: E/AndroidRuntime(294): Caused by: java.lang.ClassNotFoundException: com.callmenew.MyBroadcastReceiver
04-20 16:58:46.179: E/AndroidRuntime(294): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
04-20 16:58:46.179: E/AndroidRuntime(294): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
04-20 16:58:46.179: E/AndroidRuntime(294): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
04-20 16:58:46.179: E/AndroidRuntime(294): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2095)
04-20 16:58:46.179: E/AndroidRuntime(294): ... 10 more