Android Question AndroidManifest.xml:198: error: not well-formed (invalid token).

ykucuk

Well-Known Member
Licensed User
Longtime User
I got "AndroidManifest.xml:198: error: not well-formed (invalid token)." error while compiling. Any help ?

B4X:
B4A Version: 13.00
Parsing code.    (0.22s)
    Java Version: 17
Building folders structure.    (0.08s)
Compiling code.    (0.72s)
Compiling layouts code.    (0.02s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Compiling resources    (0.30s)
Linking resources    Error
AndroidManifest.xml:198: error: not well-formed (invalid token).

AndroidManifest
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="33" android:targetSdkVersion="34"/>
<supports-screens android:largeScreens="true" 
    android:normalScreens="true"
    android:exported="true" 
    android:smallScreens="true" 
    android:anyDensity="true"/>)        
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications
CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
CreateResourceFromFile(Macro, FirebaseAuth.FirebaseAuth)
AddPermission(android.permission.READ_EXTERNAL_STORAGE) ' Allows an application to read from external storage.
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE) ' Allows an application to write to external storage.
AddPermission(android.permission.READ_PHONE_STATE)
AddPermission(android.permission.sec.MDM_ENTERPRISE_CONTAINER)
AddPermission(android.permission.sec.MDM_APP_MGMT)
AddPermission(android.permission.sec.MDM_KIOSK_MODE)
AddPermission(com.android.launcher.permission.INSTALL_SHORTCUT)
AddManifestText(
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_RESTRICTION_MGMT"/>)
AddApplicationText(<receiver android:name=com.sentio.admin"
  android:permission="android.permission.BIND_DEVICE_ADMIN">
  <meta-data android:name="android.app.device_admin"
  android:resource="@xml/device_admin" />
  <intent-filter>
  <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
  </intent-filter>
</receiver>)
CreateResource(xml, device_admin.xml,
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-policies>
       <limit-password />
        <watch-login />
        <reset-password />
        <force-lock />
        <wipe-data />
         <allow-attachments />
        <limit-attachments />
        <allow-storagecard />
        <allow-camera />
        <allow-wifi />
        <allow-textmessaging />
        <allow-popimapemail />
        <allow-htmlemail />
        <allow-browser />
        <allow-internetsharing />
        <require-manualsyncroaming />
        <allow-bluetoothmode />
        <max-calendarage />
        <max-emailage />
        <max-emailbodytruncsize />
        <max-htmlemailbodytruncsize />
        <require-signedsmimemessages />
        <require-encryptedsmimemessages />
        <require-signedsmimealgorithm />
        <require-encryptionsmimealgorithm />
        <allow-smimeencryptionalgonegotiation />
        <allow-smimesoftcerts />
        <allow-desktopsync />
        <allow-irda />
        <require-device-encryption />
        <require-storagecard-encryption />
        <encrypted-storage />
        <mdm-application />
        <mdm-bluetooth />
        <mdm-device-inventory />
        <mdm-date-time />
        <mdm-exchange-account />
        <mdm-roaming />
        <mdm-wifi />
        <mdm-security />
        <mdm-email-account />
        <mdm-hardware-control />
        <mdm-tethering />
        <mdm-location />
        <mdm-calling />
        <mdm-email />
        <mdm-vpn />
        <mdm-apn-settings />
        <mdm-browser-settings />
        <mdm-phone-restriction />
        <mdm-firewall />
        <mdm-enterprise-vpn />
        <mdm-data-time />
    </uses-policies>
</device-admin>
)
 

Sagenut

Expert
Licensed User
Longtime User
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications
This line is missing the closing parenthesis.
Not sure if this is the only error.
Also not that B4A 13 needs to use Java 19.
You are using 17.
 
Upvote 0

Mehrzad238

Member

I believe the problem is with this part
Because not well-formed error usually happens on syntax

the correct syntax is

XML:
AddApplicationText(
<receiver android:name="com.sentio.admin"
  android:permission="android.permission.BIND_DEVICE_ADMIN">
  <meta-data android:name="android.app.device_admin"
             android:resource="@xml/device_admin" />
  <intent-filter>
    <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
  </intent-filter>
</receiver>
)

try this and let me know if that was the problem
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…