fix(android): suppress debuggable lint for diagnostic builds
This commit is contained in:
@@ -227,11 +227,19 @@ if [ "${RELEASE_DEBUGGABLE}" = "1" ]; then
|
|||||||
MANIFEST="gen/android/app/src/main/AndroidManifest.xml"
|
MANIFEST="gen/android/app/src/main/AndroidManifest.xml"
|
||||||
if [ -f "$MANIFEST" ]; then
|
if [ -f "$MANIFEST" ]; then
|
||||||
echo ">>> Marking release APK debuggable for frame-dump run-as access"
|
echo ">>> Marking release APK debuggable for frame-dump run-as access"
|
||||||
|
if ! grep -q "xmlns:tools=" "$MANIFEST"; then
|
||||||
|
perl -0pi -e "s/<manifest\\b/<manifest xmlns:tools=\"http:\\/\\/schemas.android.com\\/tools\"/s" "$MANIFEST"
|
||||||
|
fi
|
||||||
if grep -q "android:debuggable=" "$MANIFEST"; then
|
if grep -q "android:debuggable=" "$MANIFEST"; then
|
||||||
sed -i "s/android:debuggable=\"[^\"]*\"/android:debuggable=\"true\"/" "$MANIFEST"
|
sed -i "s/android:debuggable=\"[^\"]*\"/android:debuggable=\"true\"/" "$MANIFEST"
|
||||||
else
|
else
|
||||||
perl -0pi -e "s/(<application\\b[^>]*)(>)/\$1\\n android:debuggable=\"true\"\$2/s" "$MANIFEST"
|
perl -0pi -e "s/(<application\\b[^>]*)(>)/\$1\\n android:debuggable=\"true\"\$2/s" "$MANIFEST"
|
||||||
fi
|
fi
|
||||||
|
if grep -q "tools:ignore=" "$MANIFEST"; then
|
||||||
|
sed -i "s/tools:ignore=\"[^\"]*\"/tools:ignore=\"HardcodedDebugMode\"/" "$MANIFEST"
|
||||||
|
else
|
||||||
|
perl -0pi -e "s/(<application\\b[^>]*)(>)/\$1\\n tools:ignore=\"HardcodedDebugMode\"\$2/s" "$MANIFEST"
|
||||||
|
fi
|
||||||
grep -n "debuggable\\|<application" "$MANIFEST"
|
grep -n "debuggable\\|<application" "$MANIFEST"
|
||||||
else
|
else
|
||||||
echo ">>> WARNING: AndroidManifest.xml not found; release APK will not be debuggable"
|
echo ">>> WARNING: AndroidManifest.xml not found; release APK will not be debuggable"
|
||||||
|
|||||||
Reference in New Issue
Block a user