others-how to solve android 13 app not installed problem ?

1. Purpose

In this post, I will demonstrate how to solve the following problem when trying to mirgate my app to android 13(api level 33), here is the issue screenshot , it happens when I tried to install the app on my android studio emulator.

It says: App isn’t installed.



2. Solution

2.1 What is App not installed problem?

The App not installed problem happens when you want to launch an app. Actually, app not installed is a common error that many android developers encountered before. This error usually occurs when you download an app from the Google Play Store or other sources, install a signed .apk, update Android System, or do a dirty upgrade, etc.

2.2 Common solutions to solve App not installed

2.2.1 Restart

You can just try restart Android phone to fix app not installed error.

Rebooting is always a good way to solve various problems on Android devices, iOS devices and computers. This process will free up your phone’s random access memory and bring your Android phone back to normal.

2.2.2 Uninstall and reinstall the app

If restart not work, you can try to delete the old app version and install it again.

If you don’t upgrade or install apps from the Google Store, the original app may keep any conflicts with the newly installed app. In this case, you need to uninstall the old version first.

2.2.3 Upgrade the android system

You can also check and update Android version. Sometimes, app not installed error is due to incompatible Android version. You can check to see if an upgrade is available.

2.2.4 Free up android storage space

If your phone do not have much space, you can try to manage and free up Android storage space.

Sufficient Android space will guarantee that the application will install or work properly. Here you can check where the app is installed and stored. Make sure there is enough space. Check out this post to clear storage space on Android.

2.2.5 Check your SD card

If you install your app on SD card, you can try to change or format SD card to fix apps not installed.

It is recommended that you format the SD card if the application fails to install on it. Or you can remove the SD card and insert it again. After that, you can try installing the app again to see if the App not installed error pops up.

2.2.6 Check your apk file

You need to double check that the .apk file is fully downloaded. Sometimes, the APK file may be corrupted or not fully copied.

2.2.7 Allow apk from internet

Due to security concerns, some android system block apks from internet, if you want to install apk from outside Google Play, you can allow it by clicking settings--security as follows:

2.3 Solution to my problem

2.3.1 Find the reason

You can choose gradle task app-->tasks-->install-->installDebug.

If nothing new find, you can use ‘DEBUG’ mode to install and launch the app, then open android studio’s logcat to see the error logs.

I find this:

2022-12-10 12:35:52.549 1373-1373/com.google.android.apps.nexuslauncher 
E/AppLauncher: Unable to launch. tag=AppInfo(id=-1 type=APP 
    container=# com.android.launcher3.logger.LauncherAtom$ContainerInfo@1a1bf6a
    all_apps_container {

    } targetComponent=
    ComponentInfo{com.bswen.myapp/com.bswen.woreply.ui.main.SplashActivity}
     screen=-1 cell(-1,-1) span(1,1) minSpan(1,1) rank=0 
     user=UserHandle{0} title=myapp 
     componentName=ComponentInfo{com.bswen.myapp/com.bswen.woreply.ui.main.SplashActivity}) 

    intent=Intent { act=android.intent.action.MAIN 
    cat=[android.intent.category.LAUNCHER] flg=0x10200000 
    cmp=com.bswen.myapp/com.bswen.woreply.ui.main.SplashActivity bnds=[299,1610][540,1924] }

    java.lang.SecurityException: Permission Denial: 

    starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] 
    flg=0x10200000 cmp=com.bswen.myapp/com.bswen.woreply.ui.main.SplashActivity
     bnds=[299,1610][540,1924] } from ProcessRecord{d13fcaf 1373:com.google.android.apps.nexuslauncher/u0a137} 
     (pid=1373, uid=10137) not exported from uid 10161

        at android.os.Parcel.createExceptionOrNull(Parcel.java:3011)
        at android.os.Parcel.createException(Parcel.java:2995)

The key problem is:

java.lang.SecurityException: Permission Denial: 

starting Intent { act=android.intent.action.MAIN cat=[
android.intent.category.LAUNCHER] 
flg=0x10200000 cmp=com.bswen.myapp/com.bswen.woreply.ui.main.SplashActivity 

bnds=[299,1610][540,1924] } 

from ProcessRecord{d13fcaf 1373:com.google.android.apps.nexuslauncher/u0a137} 
(pid=1373, uid=10137) not exported from uid 10161

The error message means that the com.bswen.woreply.ui.main.SplashActivity can not start because it’s not exported.

Then I check the com.bswen.woreply.ui.main.SplashActivity in android_manifest.xml as follows:

        <activity android:exported="false" android:name=".ui.main.SplashActivity"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
            android:noHistory="true" android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

You can see that the android:exported is false. That is my problem!!!

2.3.2 Solve my app not installed problem

        <activity android:exported="true" android:name=".ui.main.SplashActivity"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
            android:noHistory="true" android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

key changes:

android:exported="true"

2.3.3 By the way: What does android:exported mean?

According to this document:

This element android:exported sets whether the activity can be launched by components of other applications:

  • If “true”, the activity is accessible to any app, and is launchable by its exact class name.
  • If “false”, the activity can be launched only by components of the same application, applications with the same user ID, or privileged system components. This is the default value when there are no intent filters.

If an activity in your app includes intent filters, set this element to “true” to allow other apps to start it. For example, if the activity is the main activity of the app and includes the category “android.intent.category.LAUNCHER”.

If this element is set to “false” and an app tries to start the activity, the system throws an ActivityNotFoundException.

This attribute is not the only way to limit an activity’s exposure to other applications. Permissions can also be used to limit the external entities that can invoke the activity (see the permission attribute).

So , because the activity com.bswen.woreply.ui.main.SplashActivity is the first activity in my app, the android:exported should be true.



3. Summary

In this post, I demonstrated how to solve android 13 app not installed problem. That’s it, thanks for your reading.