为了账号安全,请及时绑定邮箱和手机立即绑定

程序崩掉了


04-23 12:17:06.115 24702-24702/com.example.ly.myapplication E/AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.example.ly.myapplication.NewAppWidget: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.ly.myapplication/com.example.ly.myapplication.Myservice}; have you declared this activity in your AndroidManifest.xml?

04-23 12:17:06.115 24702-24702/com.example.ly.myapplication E/AndroidRuntime:  Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.ly.myapplication/com.example.ly.myapplication.Myservice}; have you declared this activity in your AndroidManifest.xml?

04-23 12:17:06.115 24702-24702/com.example.ly.myapplication E/AndroidRuntime:     at com.example.ly.myapplication.NewAppWidget.onEnabled(NewAppWidget.java:31)


但是也注册了啊


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.example.ly.myapplication" >

   <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.NoActionBar" >
           <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
       </activity>

       <service android:name=".Myservice"></service>


       <receiver android:name=".NewAppWidget" >
           <intent-filter>
               <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
           </intent-filter>
           <meta-data
               android:name="android.appwidget.provider"
               android:resource="@xml/new_app_widget_info" />
       </receiver>

   </application>

</manifest>

正在回答

1 回答

原来context.startService写错了 .... 这提问怎么没有撤回...

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Android-Widget桌面小组件
  • 参与学习       29582    人
  • 解答问题       31    个

Android-Widget桌面小组件的使用,带你实现多个小组件功能

进入课程

程序崩掉了

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信