Reputation: 167
A have installed my Ionic application on real device. The app is released, signed and has android:debuggable="false". I faced some problems on that specific device and I need to debug it (not to create and install new --debug build).
Is there some way to debug it? To "attach" it somehow to a keystore to be authorised, or something else...? Any ideas?
Upvotes: 7
Views: 5945
Reputation: 119
You can add this in your config.xml to solve it.
<platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:debuggable="true" />
</edit-config>
Then, you can debug in Chrome.
Upvotes: 5
Reputation: 21
I've just faced a similar issue (I wanted to create a debuggable Cordova app with cordova build android --release
) and I've also wanted to add something to the Cordova config.xml
instead of directly editing AndroidManifest.xml
, which is generally a bad idea.
The following piece of code worked for me on Cordova 8.1.2, Cordova Android platform version 7.1.4. Just put this inside your config.xml
file (somewhere inside the widget tag) and you should be good to go:
<config-file mode="merge" parent="/manifest" platform="android" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:debuggable="true" />
</config-file>
This will also cause the :app:lintVitalRelease
linter to give you a [HardcodedDebugMode]
error (and for good reason), but the APK will build fine regardless.
Upvotes: 2
Reputation: 12139
I am still trying to find a better way, but so far I am able to debug my Ionic app (a signed --release
build) running on a real device via the Chrome (desktop) console, by specifying:
<application android:debuggable="true">
directly in the AndroidManifest.xml
file. The attribute in not overwritten when I build the project with the Ionic CLI.
What I would prefer is to set the attribute from the config.xml
file, so I don't have to add it again manually in AndroidManifest.xml
when I remove/add the platform.
Upvotes: 6