Android Question Add activity-alias element into manifest issue

teddybear

Well-Known Member
Licensed User
I don't knwo how to add activity-alias element, so I added activity-alias section using AddApplicationText.
code is below
B4X:
AddApplicationText(
        <activity-alias
            android:windowSoftInputMode="stateHidden"
            android:launchMode="singleTop"
            android:name=".actalias"
            android:label="B4a alias"
            android:screenOrientation="unspecified"
            android:icon="@drawable/icon"
            android:enabled="false"
            android:targetActivity=".main">
            <intent-filter>
             <action android:name="android.intent.action.MAIN" />
              <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>
)

compiled xml is
XML:
<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="b4a.example"
    android:versionCode="1"
    android:versionName=""
    android:installLocation="internalOnly">
 
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="29"/>
    <supports-screens android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:anyDensity="true"/>
    <application
        android:icon="@drawable/icon"
        android:label="B4A Example"
        android:theme="@style/LightTheme">
    
        <activity-alias
                    android:windowSoftInputMode="stateHidden"
                    android:launchMode="singleTop"
                    android:name=".actalias"
                    android:label="B4a alias"
                    android:screenOrientation="unspecified"
                    android:icon="@drawable/icon"
                    android:enabled="false"
                    android:targetActivity=".main">
                    <intent-filter>
                     <action android:name="android.intent.action.MAIN" />
                      <category android:name="android.intent.category.LAUNCHER" />
                    </intent-filter>
                </activity-alias>
        <activity
            android:windowSoftInputMode="stateHidden"
            android:launchMode="singleTop"
            android:name=".main"
            android:label="B4A Example"
            android:screenOrientation="unspecified">
            <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        
        </activity>
    </application>
</manifest>
An error occurs when installing APK
B4X:
adb: failed to install activityalias.apk: Failure
[INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during
installPackageLI: /data/app/vmdl694309080.tmp/base.apk (at Binary XML
file line #19): <activity-alias> target activity b4a.example.main not found in
manifest with activities = [], parsedActivities = []]

I have specified target activity as b4a.example.main in activity-alias. what else do I need to?
 

Attachments

  • activityalias.zip
    154.4 KB · Views: 108
Top