abhilashhm opened a new issue, #1585:
URL: https://github.com/apache/cordova-android/issues/1585
# Bug Report
## Problem
I am trying to make couple of API calls in the index.html file. I tried
fetch, XHR XMLHttpRequest and, Jquery AJAX. They all work fine on the browser.
But, once the Android app is built, they don't do anything on the app.
Tried troubleshooting using android studio and I get this error for fetch
"cordova android "Uncaught (in promise) TypeError: Failed to fetch""
### What is expected to happen?
A simple API call should succeed.
### What does actually happen?
On the App, it does nothing.
## Information
<!-- Include all relevant information that might help understand and
reproduce the problem -->
**What I see when I run Cordova requirements is this:**
Requirements check results for android:
Java JDK: installed 11.0.8
Android SDK: installed true
Android target: not installed
Command failed with exit code 1: avdmanager list target
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/xml/bind/annotation/XmlSchema
at
com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at
com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at
com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
Caused by: java.lang.ClassNotFoundException:
javax.xml.bind.annotation.XmlSchema
at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
Gradle: installed
C:\Users\haniyura\.gradle\wrapper\dists\gradle-7.5-bin\f1w0cc9nuo0eivz97x2xlu9sv\gradle-7.5\bin\gradle.BAT
Requirements check results for browser:
Some of requirements check failed.
But the build does not fail. I am able to emulate the app on phone using
'cordova run android' command.
### Command or Code
<!-- What command or code is needed to reproduce the problem? -->
```
const url = `http://103.12.1.88/camlinwebservice/getstudentdata/8147647778`;
$.ajax({
type: "GET",
url: url,
success: function (xml) {
console.log(xml);
}, cache: false
});
```
You can find the complete code here:
[index.html](https://github.com/abhilashhm/SchoolAppCamlin/blob/main/www/index.html)
### Environment, Platform, Device
<!-- In what environment, on what platform or on which device are you
experiencing the issue? -->
Testing on Android 12 phone.
Cordova Android 11
No Plugins
SDK platform - Android 12L (API Level 32)
SDK tools - 30.0.3, 32.0.0, 33.0.2
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins (No plugins)
Other Frameworks: None
Windows, Android Studio.
-->
## Checklist
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]