我正在尝试在我的安卓手机上安装一个应用程序。它说它是成功的,但我没有在我的手机上看到它。这是我的 xml 清单
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.adr"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application android:label="@string/app_name" android:icon="@drawable/icon">
<receiver android:name=".AdrBroadcastReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.adr.intent.action.SERVICE">
</action>
</intent-filter>
</receiver>
<service android:name=".Adr">
<intent-filter>
<action android:name="com.adr.intent.action.SERVICE">
</action>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>>
</service>
</application>
</manifest>
编辑的代码:现在我从 logcat 收到错误。该应用程序出现了,但一旦我点击它说不幸的是,adr 已停止。我现在在我的 logcat 中得到了很多东西。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.adr"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:name=".YourActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<receiver android:name=".AdrBroadcastReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.adr.intent.action.SERVICE">
</action>
</intent-filter>
</receiver>
<service android:name=".Adr">
<intent-filter>
<action android:name="com.adr.intent.action.SERVICE">
</action>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>>
</service>
</application>
</manifest>
这就是我在 logcat 中得到的 -
06-27 16:38:45.814: D/AndroidRuntime(5324): Shutting down VM
06-27 16:38:45.814: W/dalvikvm(5324): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
06-27 16:38:45.864: E/AndroidRuntime(5324): FATAL EXCEPTION: main
06-27 16:38:45.864: E/AndroidRuntime(5324): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.adr/com.adr.YourActivity}: java.lang.ClassNotFoundException: Didn't find class "com.adr.YourActivity" on path: /data/app/com.adr-1.apk
06-27 16:38:45.864: E/AndroidRuntime(5324): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
06-27 16:38:45.864: E/AndroidRuntime(5324): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-27 16:38:45.864: E/AndroidRuntime(5324): at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-27 16:38:45.864: E/AndroidRuntime(5324): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-27 16:38:45.864: E/AndroidRuntime(5324): at android.os.Handler.dispatchMessage(Handler.java:99)
06-27 16:38:45.864: E/AndroidRuntime(5324): at android.os.Looper.loop(Looper.java:137)
06-27 16:38:45.864: E/AndroidRuntime(5324): at android.app.ActivityThread.main(ActivityThread.java:5041)
06-27 16:38:45.864: E/AndroidRuntime(5324): at java.lang.reflect.Method.invokeNative(Native Method)
06-27 16:38:45.864: E/AndroidRuntime(5324): at java.lang.reflect.Method.invoke(Method.java:511)
06-27 16:38:45.864: E/AndroidRuntime(5324): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-27 16:38:45.864: E/AndroidRuntime(5324): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-27 16:38:45.864: E/AndroidRuntime(5324): at dalvik.system.NativeStart.main(Native Method)
06-27 16:38:45.864: E/AndroidRuntime(5324): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.adr.YourActivity" on path: /data/app/com.adr-1.apk
06-27 16:38:45.864: E/AndroidRuntime(5324): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
06-27 16:38:45.864: E/AndroidRuntime(5324): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-27 16:38:45.864: E/AndroidRuntime(5324): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-27 16:38:45.864: E/AndroidRuntime(5324): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
06-27 16:38:45.864: E/AndroidRuntime(5324): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
06-27 16:38:45.864: E/AndroidRuntime(5324): ... 11 more