2014-11-23 119 views
0

我试图运行一个演示项目来实现小部件,它编译成功,但没有启动,也没有发现它安装在我的手机中。无法在设备上启动应用程序

我下面这个教程http://www.tutorialspoint.com/android/android_widgets.htm

A也本教程https://github.com/TechIsFun/android-widget-example,但得到了同样的问题。

我的控制台显示

[2014-11-23 11:01:30 - WidgetExample] Performing sync 
[2014-11-23 11:01:30 - WidgetExample] Automatic Target Mode: Unable to detect device compatibility. Please select a target device. 
[2014-11-23 11:01:34 - WidgetExample] Uploading WidgetExample.apk onto device '1C9E_9E18_MicromaxA111' 
[2014-11-23 11:01:34 - WidgetExample] Installing WidgetExample.apk... 
[2014-11-23 11:01:37 - WidgetExample] Success! 
[2014-11-23 11:01:37 - WidgetExample] \WidgetExample\bin\WidgetExample.apk installed on device 
[2014-11-23 11:01:37 - WidgetExample] Done! 

我认为有一些问题清单文件?

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.example.widgetexample" 
android:versionCode="1" 
android:versionName="1.0" > 

<uses-sdk 
    android:minSdkVersion="8" 
    android:targetSdkVersion="21" /> 

<application 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 

    <receiver 
     android:name="MyWidgetProvider" 
     android:icon="@drawable/ic_launcher" 
     android:label="Example Widget" > 
     <intent-filter> 
      <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> 
     </intent-filter> 

     <meta-data 
      android:name="android.appwidget.provider" 
      android:resource="@xml/widget_info" /> 
    </receiver> 
</application> 

</manifest> 
+0

1-尝试拔下设备并重新插入; 2-尝试重新启动设备; 3-尝试检查USB调试选项,然后再次检查它是否打开。请评论如果这些不起作用。 – 2014-11-23 05:40:19

+0

manifest.xml中缺少主要启动程序活动 – Nepster 2014-11-23 07:18:37

+0

如果找到答案,请关闭该问题。 – 2014-11-30 13:27:18

回答

0

您的控制台消息显示您的apk已在设备上显得有问题。现在的问题是为什么它没有启动? 要启动任何应用程序,它至少应该有一个活动,并将其作为启动程序的主要和类别。

 <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 

就你而言,你的应用程序没有任何与它相关的活动。 我认为这是为什么它没有得到启动一个sccuessful安装。这也就是为什么它没有在应用程序列表中显示你的应用程序

由于您的应用程序只有一个小部件,因此它将显示在小部件列表下。请检查。

希望它可以帮助你。

相关问题