Skip to content

Commit a93279a

Browse files
committed
chore(android): enable WebView debugging and a local debug-APK build script
Lets chrome://inspect attach to the WebView in debug builds, and adds cap:android:build:debug for producing a sideloadable debug APK without signing credentials.
1 parent 0d27f72 commit a93279a

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

android/app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ android {
2222
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2323
}
2424
}
25+
buildFeatures {
26+
buildConfig true
27+
}
2528
}
2629

2730
repositories {

android/app/src/main/java/me/payky/MainActivity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.os.Bundle;
66
import android.view.Window;
77
import android.view.WindowManager;
8+
import android.webkit.WebView;
89
import androidx.core.view.WindowCompat;
910
import androidx.core.view.WindowInsetsControllerCompat;
1011
import com.getcapacitor.BridgeActivity;
@@ -15,6 +16,10 @@ public class MainActivity extends BridgeActivity {
1516
protected void onCreate(Bundle savedInstanceState) {
1617
super.onCreate(savedInstanceState);
1718
enableEdgeToEdge();
19+
20+
if (BuildConfig.DEBUG) {
21+
WebView.setWebContentsDebuggingEnabled(true);
22+
}
1823
}
1924

2025
private void enableEdgeToEdge() {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"cap:android:sync": "bun run cap:build && cap sync android",
1515
"cap:android:dev": "PAYKY_DISABLE_BASIC_SSL=1 bun run dev -- --host 0.0.0.0 --strictPort & PAYKY_VITE_PID=$!; trap 'kill $PAYKY_VITE_PID' EXIT; until curl -sSf http://127.0.0.1:5173 >/dev/null; do kill -0 $PAYKY_VITE_PID || exit 1; sleep 0.25; done; cap run android --live-reload --host 127.0.0.1 --port 5173 --forwardPorts 5173:5173; wait $PAYKY_VITE_PID",
1616
"cap:android:build": "bun run cap:android:build:apk",
17+
"cap:android:build:debug": "bun run cap:android:sync && cd android && ./gradlew assembleDebug",
1718
"cap:android:build:apk": ": ${PAYKY_ANDROID_KEYSTORE_PASSWORD:?Set PAYKY_ANDROID_KEYSTORE_PASSWORD} && : ${PAYKY_ANDROID_KEY_ALIAS:?Set PAYKY_ANDROID_KEY_ALIAS} && : ${PAYKY_ANDROID_KEY_PASSWORD:?Set PAYKY_ANDROID_KEY_PASSWORD} && bun run cap:android:sync && cap build android --androidreleasetype APK --signing-type apksigner --keystorepath ../payky-release.keystore --keystorepass \"$PAYKY_ANDROID_KEYSTORE_PASSWORD\" --keystorealias \"$PAYKY_ANDROID_KEY_ALIAS\" --keystorealiaspass \"$PAYKY_ANDROID_KEY_PASSWORD\"",
1819
"cap:android:build:aab": ": ${PAYKY_ANDROID_KEYSTORE_PASSWORD:?Set PAYKY_ANDROID_KEYSTORE_PASSWORD} && : ${PAYKY_ANDROID_KEY_ALIAS:?Set PAYKY_ANDROID_KEY_ALIAS} && : ${PAYKY_ANDROID_KEY_PASSWORD:?Set PAYKY_ANDROID_KEY_PASSWORD} && bun run cap:android:sync && cap build android --androidreleasetype AAB --keystorepath ../payky-release.keystore --keystorepass \"$PAYKY_ANDROID_KEYSTORE_PASSWORD\" --keystorealias \"$PAYKY_ANDROID_KEY_ALIAS\" --keystorealiaspass \"$PAYKY_ANDROID_KEY_PASSWORD\"",
1920
"check:lint": "biome check .",

0 commit comments

Comments
 (0)