Не работает json в phonegap с cli-9.0.0 и android-targetSdkVersion 28

Не могу достучаться до ajax, например через:

$.getJSON("http://site.com/api_v8/product/read_user_comments.php?id=" + id, function(data){
//тут код
});

jquerry внутри проекта. (то есть не закачиваеться по внешним ссылкам)

во всех html прописал

<head>  <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> </head>

но все равно не работает когда ставлю в config 28 SDK

<preference name="android-targetSdkVersion" value="28" />
<preference name="phonegap-version" value="cli-9.0.0" />

а например с 19 SDK работает

так же не забыл про

<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />

В чем может быть проблема ?

вот мой сonfig

<?xml version='1.0' encoding='utf-8'?> <widget id="com.my.stat" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
    <name> My Stat </name>
    <description>
        My Stat 
    </description>
    <author email="[email protected]" href="http://phonegap.com">
        My Stat 
    </author>
    <content src="index.html" />    <preference name="phonegap-version" value="cli-9.0.0" />
    <preference name="DisallowOverscroll" value="true" />   
    <preference name="SplashScreenDelay" value="500" />  
    <preference name="AutoHideSplashScreen" value="true" />
    <preference name="SplashMaintainAspectRatio" value="true" />    <preference name="android-targetSdkVersion" value="28" />

    <plugin name="cordova-plugin-splashscreen" source="npm" /> 
    <plugin name="cordova-plugin-whitelist" source="npm"/>  

    <allow-navigation href="https://*youtube.com/*"/>
    <icon src="icon.png" />
    <splash src="splash.png" />
    <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:*" />
        <allow-intent href="http://site.com/api_v8/*" />        
    </platform>


    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform> </widget>

Ответы (1 шт):

Автор решения: Федор Денисенко

Проблему решил.

Собственно нагуглил решение в англоязычном интернете.

Суть в том, что при SDK 28 Андроид по дефолту не разрешает соединений http для json Но если для вас, переход на https не вариант нужно играться с - cleartextTrafficPermitted="true"

для этого надо создать android/res/xml/network_security_config.xm

<?xml version="1.0" encoding="utf-8"?>
    <network-security-config>
    <base-config cleartextTrafficPermitted="true" />
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">Your URL(ex: 127.0.0.1)</domain>
    </domain-config>
    </network-security-config>

и в файле AndroidManifest.xml добавить

 <?xml version="1.0" encoding="utf-8"?>
    <manifest ...>
        <uses-permission android:name="android.permission.INTERNET" />
        <application
            ...
            android:networkSecurityConfig="@xml/network_security_config"
            ...>
            ...
        </application>
    </manifest>

Ну а далее делаем билд в Android Studio и получаем подписанный релиз.

→ Ссылка