I have started working with Android Studio today and created a simple Hello World application.
I have built it to APK file. Then I have moved this APK file onto my phone. I have installed this APK. The icon on the desktop of the phone has appeared, but when I am clicking it, the error appears: Application not found.
Phone: Xiaomi Redmi Note 7, Andriod 10.
Android Studio project is built for Andriod systems, that start from Android 5 Lollipop.
I have have tried to resolve the issue and tried different things. Considering, that I am not sure, where is the problem (xiaomi system, android os, AndroidManifest file, permissions, etc...) I have tried different approaches:
- In case if the problem with the Xiaomi phone:
I have tried to disable MIUI optimization, enable USB debugging, and enable installation through USB. That is in Android developers settings. That did not help and the phone started glitching.
- In case, if the problem is in a way, in which I have built the APK:
I have tried building it Build > Build Bundle(s) / APK(s) > Build APK(s). When I saw, that my phone says, that the "Application not found", I have tried doing it through Build > Generate Signed Bundle/APK... Then I have tried both, for debugging and for release. Nothing has helped.
When I thought, that it can be related to permissions to install apps from different sources, I have tried disabling Google Play Protection Scanning. That also did not help.
I was looking deeper into the AndroidManifest.xml, maybe the problem is there, but it seems to be ok. Here is a peace of code:
<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>
So I really dont know, what am I to do and how to fix it. Any ideas? Thanks.
Edit:
I have a slow PC, so Android Emulator in the android studio is not working, thus I cannot say, how that would be with the emulator.
Also, I looked into the folder Android/data/ on my phone and did not find "com.example.music" package (that should be the package name for my application). But I am not sure, that this package should be necessarily in this folder.
I have scanned this installed application with APK analyzer and it states, that the package for the app is "com.example.music" and that it exists somewhere on the phone. That means, that the app should basically link it, and it should be somewhere.
Edit 2:
So I have tried debugging this thing through logcat, and that what I have recieved:
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.access$11301(Launcher.java:357)
at com.miui.home.launcher.Launcher.lambda$startActivityForResult$47(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.access$3500(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)
CodePudding user response:
Can you not try building directly to the device via debugging? You should check the logcat, make sure you had a successful build, and try installing the app via USB debugging.