feat: Add Android application resources and assets.
All checks were successful
Build and Release / build-and-release (push) Successful in 12m21s
All checks were successful
Build and Release / build-and-release (push) Successful in 12m21s
This commit is contained in:
@@ -76,62 +76,7 @@ jobs:
|
||||
|
||||
- name: Capacitor sync
|
||||
run: |
|
||||
npx cap add android
|
||||
echo "sdk.dir=${ANDROID_SDK_ROOT}" > android/local.properties
|
||||
|
||||
# Patch AndroidManifest.xml to add required permissions
|
||||
node -e "
|
||||
const fs = require('fs');
|
||||
const manifestPath = 'android/app/src/main/AndroidManifest.xml';
|
||||
let manifest = fs.readFileSync(manifestPath, 'utf8');
|
||||
|
||||
const permissions = [
|
||||
'<uses-permission android:name=\"android.permission.RECORD_AUDIO\" />',
|
||||
'<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\" />',
|
||||
'<uses-permission android:name=\"android.permission.CAMERA\" />',
|
||||
'<uses-permission android:name=\"android.permission.BLUETOOTH\" android:maxSdkVersion=\"30\" />',
|
||||
'<uses-permission android:name=\"android.permission.BLUETOOTH_CONNECT\" />',
|
||||
'<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\" />'
|
||||
];
|
||||
|
||||
const permBlock = permissions.join('\n ');
|
||||
manifest = manifest.replace(
|
||||
'</manifest>',
|
||||
' ' + permBlock + '\n</manifest>'
|
||||
);
|
||||
|
||||
fs.writeFileSync(manifestPath, manifest);
|
||||
console.log('Patched AndroidManifest.xml with permissions');
|
||||
"
|
||||
|
||||
# Append a merged android block with signingConfigs + buildTypes.release signing
|
||||
# Gradle merges multiple android {} blocks, and within one block signingConfigs
|
||||
# is evaluated before buildTypes, so the reference resolves correctly.
|
||||
node -e "
|
||||
const fs = require('fs');
|
||||
const p = 'android/app/build.gradle';
|
||||
let g = fs.readFileSync(p, 'utf8');
|
||||
g += \`
|
||||
android {
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file(System.getenv(\"ANDROID_KEYSTORE_FILE\") ?: \"/dev/null\")
|
||||
storePassword System.getenv(\"ANDROID_KEYSTORE_PASSWORD\") ?: \"\"
|
||||
keyAlias System.getenv(\"ANDROID_KEY_ALIAS\") ?: \"\"
|
||||
keyPassword System.getenv(\"ANDROID_KEY_PASSWORD\") ?: \"\"
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
}
|
||||
\`;
|
||||
fs.writeFileSync(p, g);
|
||||
console.log('Patched build.gradle with signing config');
|
||||
"
|
||||
|
||||
npx cap sync android
|
||||
working-directory: apps/android
|
||||
|
||||
|
||||
Reference in New Issue
Block a user