Hi I am trying to debug my phonegap app on my device via Chrome I have followed all the steps and my phone is recognized by adb devices command,
Then I go to chrome://inspect/#devices and I can see my phone but this message appears on the browser:
Offline
Pending authentication: please accept debugging session on the device.
The thing is that there is no such message in my phone, I have a Sansumg Galaxy S2 with kitkat. I updated the version from 4.1 to 4.4 because I thought that was the issue but after updgrading to 4.4 same problem.
Has anyone faced this problem before??
Connect your phone to your computer with USB. On your device, an alert prompts you to allow USB debugging from your computer. Tap OK. Launch your cordova App by running cordova run android or installing the app with adb ( adb -d install -r platforms/android/build/outputs/apk/android-debug.
The problem is that remote debugging used to only work for the Chrome browser on Android, but not in webviews inside of apps like phonegap uses. But with Android 4.4 (Kitkat) and Phonegap 3.3, this is now supported.
I wrote a blog post about it here:
http://adamwadeharris.com/remote-debugging-in-phonegap-with-chrome-devtools/
Basically you need to enable webview debugging in the app's main Java file, and make sure your app is targeting API version 19 (Kitkat). If you don't have a device with Kitkat, you could use an emulator instead.
Here's how you enable webview debugging:
In platforms/android/src/com/yourAppName/YourAppName.java add the following lines under the other import statements
import android.os.Build;
import android.webkit.WebView;
And add the following inside the onCreate method:
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With