Android phone 不启动开发的apk
Android phone does not launch the developed apk
我今天开始使用 Android Studio 并创建了一个简单的 Hello World 应用程序。
我已经将它构建为 APK 文件。然后我将这个 APK 文件移到了我的 phone 上。
我已经安装了这个 APK。 phone桌面上的图标出现了,但是我点击它的时候出现错误:Application not found.
Phone: 小米红米 Note 7, 安卓 10.
Android Studio 项目是为 Andriod 系统构建的,从 Android 5 Lollipop 开始。
我已经尝试解决这个问题并尝试了不同的方法。
考虑到,我不确定问题出在哪里(小米系统,android os,AndroidManifest 文件,权限等...)我尝试了不同的方法:
- 万一小米有问题phone:
我试过关闭MIUI优化,开启USB调试,开启U盘安装。那是在 Android 开发人员设置中。
这没有帮助,phone 开始出现故障。
- 以防万一,如果问题出在我构建 APK 的方式上:
我已经尝试构建它构建 > 构建捆绑包/APK(s) > 构建 APK(s)。
当我看到我的 phone 说“找不到应用程序”时,我尝试通过 Build > Generate Signed Bundle/APK...
然后我都尝试了调试和发布。
没有任何帮助。
当我想到它可能与从不同来源安装应用程序的权限有关时,我尝试禁用 Google Play 保护扫描。
这也没有帮助。
我正在深入研究AndroidManifest.xml,也许问题就在那里,但似乎没问题。
这是一个和平的代码:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Music">
<activity
android:name=".MainActivity"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
所以我真的不知道,我该怎么办以及如何解决它。有任何想法吗?
谢谢
编辑:
我的 PC 速度很慢,所以 Android android 工作室中的模拟器无法正常工作,因此我不能说模拟器会怎样。
此外,我查看了 phone 上的文件夹 Android/data/,但没有找到“com.example.music”包(这应该是我的应用程序的包名称)。但是我不确定,这个包应该在这个文件夹中。
我用 APK 分析器扫描了这个已安装的应用程序,它指出,该应用程序的包是“com.example.music”,并且它存在于 phone 上的某处。这意味着,该应用基本上应该 link 它,并且它应该在某个地方。
编辑 2:
所以我尝试通过 logcat 调试这个东西,我收到的是:
2022-05-05 23:38:52.316 2476-2476/? E/Launcher: Launcher does not have the permission to launch Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.music/.MainActivity bnds=[76,1104][244,1272] (has extras) }. Make sure to create a MAIN intent-filter for the corresponding activity or use the exported attribute for this activity.
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.music/.MainActivity bnds=[76,1104][244,1272] (has extras) } from ProcessRecord{6cc44ac 2476:com.miui.home/u0a35} (pid=2476, uid=10035) not exported from uid 10498
at android.os.Parcel.createException(Parcel.java:2074)
at android.os.Parcel.readException(Parcel.java:2042)
at android.os.Parcel.readException(Parcel.java:1990)
at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:3973)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1716)
at android.app.Activity.startActivityForResult(Activity.java:5258)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:584)
at com.miui.home.launcher.Launcher.access301(Launcher.java:357)
at com.miui.home.launcher.Launcher.lambda$startActivityForResult(Launcher.java:4602)
at com.miui.home.launcher.-$$Lambda$Launcher$jL9lylEWGhHCXkZoMaZMAX7ydlQ.run(Unknown Source:8)
at com.miui.home.launcher.Launcher.safelyStartActivity(Launcher.java:4557)
at com.miui.home.launcher.Launcher.startActivityForResult(Launcher.java:4594)
at android.app.Activity.startActivity(Activity.java:5583)
at com.miui.home.launcher.Launcher.startActivity(Launcher.java:4541)
at com.miui.home.launcher.Launcher$PerformLaunchAction.run(Launcher.java:4471)
at com.miui.home.launcher.Launcher$PerformLaunchAction.launch(Launcher.java:4451)
at com.miui.home.launcher.Launcher.launch(Launcher.java:4422)
at com.miui.home.launcher.ShortcutInfo.handleClick(ShortcutInfo.java:708)
at com.miui.home.launcher.Launcher.onClick(Launcher.java:4394)
at android.view.View.performClick(View.java:7185)
at android.view.View.performClickInternal(View.java:7162)
at android.view.View.access00(View.java:819)
at android.view.View$PerformClick.run(View.java:27678)
at com.miui.home.launcher.ItemIcon.post(ItemIcon.java:442)
at android.view.View.onTouchEvent(View.java:14899)
at com.miui.home.launcher.ItemIcon.onTouchEvent(ItemIcon.java:420)
at android.view.View.dispatchTouchEvent(View.java:13484)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3082)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2767)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at com.miui.home.launcher.CellLayout.dispatchTouchEvent(CellLayout.java:629)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at com.miui.home.launcher.Workspace.dispatchTouchEvent(Workspace.java:729)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at com.miui.home.launcher.DragLayer.dispatchTouchEvent(DragLayer.java:237)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at com.miui.home.launcher.ShortcutMenuLayer.dispatchTouchEvent(ShortcutMenuLayer.java:107)
2022-05-05 23:38:52.316 2476-2476/? E/Launcher: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:498)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1853)
at android.app.Activity.dispatchTouchEvent(Activity.java:4059)
at com.miui.home.launcher.Launcher.dispatchTouchEvent(Launcher.java:4246)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:456)
at android.view.View.dispatchPointerEvent(View.java:13745)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5635)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5435)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4936)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4989)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4955)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5095)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4963)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5152)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4936)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4989)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4955)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4963)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4936)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7688)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7657)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7618)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7816)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:251)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:336)
at android.os.Looper.loop(Looper.java:181)
at android.app.ActivityThread.main(ActivityThread.java:7590)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.wm.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1089)
at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:789)
at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:588)
at com.android.server.wm.ActivityStarter.startActivityMayWait(ActivityStarter.java:1390)
at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:519)
你能不能不尝试通过调试直接构建到设备上?您应该检查 logcat,确保构建成功,然后尝试通过 USB 调试安装应用程序。
我今天开始使用 Android Studio 并创建了一个简单的 Hello World 应用程序。
我已经将它构建为 APK 文件。然后我将这个 APK 文件移到了我的 phone 上。 我已经安装了这个 APK。 phone桌面上的图标出现了,但是我点击它的时候出现错误:Application not found.
Phone: 小米红米 Note 7, 安卓 10.
Android Studio 项目是为 Andriod 系统构建的,从 Android 5 Lollipop 开始。
我已经尝试解决这个问题并尝试了不同的方法。 考虑到,我不确定问题出在哪里(小米系统,android os,AndroidManifest 文件,权限等...)我尝试了不同的方法:
- 万一小米有问题phone:
我试过关闭MIUI优化,开启USB调试,开启U盘安装。那是在 Android 开发人员设置中。 这没有帮助,phone 开始出现故障。
- 以防万一,如果问题出在我构建 APK 的方式上:
我已经尝试构建它构建 > 构建捆绑包/APK(s) > 构建 APK(s)。 当我看到我的 phone 说“找不到应用程序”时,我尝试通过 Build > Generate Signed Bundle/APK... 然后我都尝试了调试和发布。 没有任何帮助。
当我想到它可能与从不同来源安装应用程序的权限有关时,我尝试禁用 Google Play 保护扫描。 这也没有帮助。
我正在深入研究AndroidManifest.xml,也许问题就在那里,但似乎没问题。 这是一个和平的代码:
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.Music"> <activity android:name=".MainActivity" android:exported="false"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application>
所以我真的不知道,我该怎么办以及如何解决它。有任何想法吗? 谢谢
编辑:
我的 PC 速度很慢,所以 Android android 工作室中的模拟器无法正常工作,因此我不能说模拟器会怎样。
此外,我查看了 phone 上的文件夹 Android/data/,但没有找到“com.example.music”包(这应该是我的应用程序的包名称)。但是我不确定,这个包应该在这个文件夹中。
我用 APK 分析器扫描了这个已安装的应用程序,它指出,该应用程序的包是“com.example.music”,并且它存在于 phone 上的某处。这意味着,该应用基本上应该 link 它,并且它应该在某个地方。
编辑 2:
所以我尝试通过 logcat 调试这个东西,我收到的是:
2022-05-05 23:38:52.316 2476-2476/? E/Launcher: Launcher does not have the permission to launch Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.music/.MainActivity bnds=[76,1104][244,1272] (has extras) }. Make sure to create a MAIN intent-filter for the corresponding activity or use the exported attribute for this activity.
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.music/.MainActivity bnds=[76,1104][244,1272] (has extras) } from ProcessRecord{6cc44ac 2476:com.miui.home/u0a35} (pid=2476, uid=10035) not exported from uid 10498
at android.os.Parcel.createException(Parcel.java:2074)
at android.os.Parcel.readException(Parcel.java:2042)
at android.os.Parcel.readException(Parcel.java:1990)
at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:3973)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1716)
at android.app.Activity.startActivityForResult(Activity.java:5258)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:584)
at com.miui.home.launcher.Launcher.access301(Launcher.java:357)
at com.miui.home.launcher.Launcher.lambda$startActivityForResult(Launcher.java:4602)
at com.miui.home.launcher.-$$Lambda$Launcher$jL9lylEWGhHCXkZoMaZMAX7ydlQ.run(Unknown Source:8)
at com.miui.home.launcher.Launcher.safelyStartActivity(Launcher.java:4557)
at com.miui.home.launcher.Launcher.startActivityForResult(Launcher.java:4594)
at android.app.Activity.startActivity(Activity.java:5583)
at com.miui.home.launcher.Launcher.startActivity(Launcher.java:4541)
at com.miui.home.launcher.Launcher$PerformLaunchAction.run(Launcher.java:4471)
at com.miui.home.launcher.Launcher$PerformLaunchAction.launch(Launcher.java:4451)
at com.miui.home.launcher.Launcher.launch(Launcher.java:4422)
at com.miui.home.launcher.ShortcutInfo.handleClick(ShortcutInfo.java:708)
at com.miui.home.launcher.Launcher.onClick(Launcher.java:4394)
at android.view.View.performClick(View.java:7185)
at android.view.View.performClickInternal(View.java:7162)
at android.view.View.access00(View.java:819)
at android.view.View$PerformClick.run(View.java:27678)
at com.miui.home.launcher.ItemIcon.post(ItemIcon.java:442)
at android.view.View.onTouchEvent(View.java:14899)
at com.miui.home.launcher.ItemIcon.onTouchEvent(ItemIcon.java:420)
at android.view.View.dispatchTouchEvent(View.java:13484)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3082)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2767)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at com.miui.home.launcher.CellLayout.dispatchTouchEvent(CellLayout.java:629)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at com.miui.home.launcher.Workspace.dispatchTouchEvent(Workspace.java:729)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at com.miui.home.launcher.DragLayer.dispatchTouchEvent(DragLayer.java:237)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at com.miui.home.launcher.ShortcutMenuLayer.dispatchTouchEvent(ShortcutMenuLayer.java:107)
2022-05-05 23:38:52.316 2476-2476/? E/Launcher: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3088)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2781)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:498)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1853)
at android.app.Activity.dispatchTouchEvent(Activity.java:4059)
at com.miui.home.launcher.Launcher.dispatchTouchEvent(Launcher.java:4246)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:456)
at android.view.View.dispatchPointerEvent(View.java:13745)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5635)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5435)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4936)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4989)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4955)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5095)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4963)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5152)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4936)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4989)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4955)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4963)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4936)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7688)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7657)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7618)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7816)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:251)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:336)
at android.os.Looper.loop(Looper.java:181)
at android.app.ActivityThread.main(ActivityThread.java:7590)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.wm.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1089)
at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:789)
at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:588)
at com.android.server.wm.ActivityStarter.startActivityMayWait(ActivityStarter.java:1390)
at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:519)
你能不能不尝试通过调试直接构建到设备上?您应该检查 logcat,确保构建成功,然后尝试通过 USB 调试安装应用程序。