---Edit---
Forgot to include original manifest. Here it is:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.web.scratch_v2">
<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/AppTheme" >
<activity
android:name="android.support.customtabs.trusted.LauncherActivity"
android:label="${launcherName}">
<meta-data
android:name="android.support.customtabs.trusted.DEFAULT_URL"
android:value="${defaultUrl}"/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:scheme="https"
android:host="${hostName}"/>
</intent-filter>
</activity>
<meta-data
android:name="asset_statements"
android:value="${assetStatements}" />
</application>
</manifest>
Original Post:
I'm very new to android dev but am currently trying to package my PWA as an APK via trusted web activities.
Where I'm at:
- the app installs and runs on an emulated device
- it runs in a TWA, not as a custom tab. However, after generating a signed APK
The Problem:
- When I profile the generated APK, I get the error "Error running app-release, default activity not found".
My assessment:
The problem seems to be in the manifest generated by the signed apk process and here's that manifest. There are a few namespace errors that do not exist in the manifest of the project I am building from, as well as an unresolved package (customtabs) in the activity. Here is the manifest from the generated signed APK (this APK is output in a different directory than the project):
<?xml version="1.0" encoding="utf-8"?><manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
android:compileSdkVersion="29"
android:compileSdkVersionCodename="10"
package="app.web.scratch_v2"
platformBuildVersionCode="29"
platformBuildVersionName="10">
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="29" />
<application
android:theme="@ref/0x7f0d0005"
android:label="@ref/0x7f0c001b"
android:icon="@ref/0x7f0b0000"
android:allowBackup="true"
android:supportsRtl="true"
android:roundIcon="@ref/0x7f0b0001"
android:appComponentFactory="androidx.core.app.CoreComponentFactory">
<activity
android:label="my-name"
android:name="android.support.customtabs.trusted.LauncherActivity">
<meta-data
android:name="android.support.customtabs.trusted.DEFAULT_URL"
android:value="my-url" />
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter
android:autoVerify="true">
<action
android:name="android.intent.action.VIEW" />
<category
android:name="android.intent.category.DEFAULT" />
<category
android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="my-host-here" />
</intent-filter>
</activity>
<meta-data
android:name="asset_statements"
android:value="[{ "relation": ["delegate_permission/common.handle_all_urls"], "target": {"namespace": "web", "site": "https://my-link-here/"}}]" />
</application>
</manifest>
But, when I replace that manifest path with the manifest in the "/app/build/intermediates/bundle_manifest/release/bundle-manifest/AndroidManifest.xml" (from the same project) everything is fixed, and the APK runs great. Here's that manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.web.scratch_v2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="29" />
<application
android:allowBackup="true"
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:testOnly="true"
android:theme="@style/AppTheme" >
<activity
android:name="android.support.customtabs.trusted.LauncherActivity"
android:label="my-name" >
<meta-data
android:name="android.support.customtabs.trusted.DEFAULT_URL"
android:value="my-url" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true" >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="my-host-here"
android:scheme="https" />
</intent-filter>
</activity>
<meta-data
android:name="asset_statements"
android:value="[{ "relation": ["delegate_permission/common.handle_all_urls"], "target": {"namespace": "web", "site": "https://my-link-here/"}}]" />
</application>
</manifest>
So, I'm sure it is poor config in my project that is breaking this, but I cannot find the mistake. Any suggestions are appreciated!