Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/196.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何修复https请求cordova的404_Android_Angular_Cordova - Fatal编程技术网

Android 如何修复https请求cordova的404

Android 如何修复https请求cordova的404,android,angular,cordova,Android,Angular,Cordova,如果我用angular调用我的web服务PHP,那么使用cordova android,响应是404找不到 polyfills.a4021de…js:1篇文章http://localhost:8000/credit/login_json.php 404(未找到) main.8da6860…js:1错误 Gc{标题:Nc,状态:404,状态文本:“未找到”,url:http://localhost:8000/credit/login_json.php“,ok:false,…} 错误:“↵↵↵↵错误

如果我用angular调用我的web服务PHP,那么使用cordova android,响应是404找不到

polyfills.a4021de…js:1篇文章http://localhost:8000/credit/login_json.php 404(未找到) main.8da6860…js:1错误 Gc{标题:Nc,状态:404,状态文本:“未找到”,url:http://localhost:8000/credit/login_json.php“,ok:false,…} 错误:“↵↵↵↵错误↵↵↵ Cannot POST /credit/login_json.php angular项目的文件package.json

> {   "name": "a2-agence",   "version": "0.0.0",
>      "scripts": {
>     "ng": "ng",
>     "start": "ng serve --proxy-config proxy.conf.json",
>     "build": "ng build",
>     "test": "ng test",
>     "lint": "ng lint",
>     "e2e": "ng e2e"   },
>     "private": true,   "dependencies": {
>     "@angular/animations": "~10.0.6",
>     "@angular/common": "~10.0.6",
>     "@angular/compiler": "~10.0.6",
>     "@angular/core": "~10.0.6",
>     "@angular/forms": "~10.0.6",
>     "@angular/platform-browser": "~10.0.6",
>     "@angular/platform-browser-dynamic": "~10.0.6",
>     "@angular/router": "~10.0.6",
>     "cors": "^2.8.5",
>     "escpos": "^3.0.0-alpha.6",
>     "ng-thermal-print": "^1.0.3",
>     "ngx-cookie-service": "^10.0.1",
>     "path": "^0.12.7",
>     "roboto-fontface": "^0.10.0",
>     "rxjs": "~6.5.5",
>     "stream": "0.0.2",
>     "tslib": "^2.0.0",
>     "zlib": "^1.0.5",
>     "zone.js": "~0.10.3"   },   "devDependencies": {
>     "@angular-devkit/build-angular": "~0.1000.5",
>     "@angular/cli": "~10.0.5",
>     "@angular/compiler-cli": "~10.0.6",
>     "@types/jasmine": "~3.5.0",
>     "@types/jasminewd2": "~2.0.3",
>     "@types/node": "^12.12.55",
>     "codelyzer": "^6.0.0",
>     "cordova-android": "^9.0.0",
>     "cordova-plugin-whitelist": "^1.3.4",
>     "jasmine-core": "~3.5.0",
>     "jasmine-spec-reporter": "~5.0.0",
>     "karma": "~5.0.0",
>     "karma-chrome-launcher": "~3.1.0",
>     "karma-coverage-istanbul-reporter": "~3.0.2",
>     "karma-jasmine": "~3.3.0",
>     "karma-jasmine-html-reporter": "^1.5.0",
>     "protractor": "~7.0.0",
>     "ts-node": "~8.3.0",
>     "tslint": "~6.1.0",
>     "typescript": "~3.9.5"   } }
cordova项目的/config.xml文件

 <?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>HelloCordova</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
  
 <content src="index.html" />
     <allow-navigation href="*" />
    <allow-navigation href="http://*/*" />
    <allow-navigation href="https://*/*" />
    <allow-intent href="*" />
    <access origin="*" />
   
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
       
       <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
</widget> 

HelloCordova
响应deviceready事件的Apache Cordova应用程序示例。
阿帕奇科尔多瓦团队
文件AndroidManifest.xml

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="io.cordova.hellocordova" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest> 

检查您是否使用正确的方法(GET、POST等)呼叫,并发布连接到后端的代码
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="io.cordova.hellocordova" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>