SVG not visible with android (cordova)

0

I am making a web game. Concerning the GUI, I decided to use HTML instead of canvas. Running the application from web browsers on computer works like a charm. However, after to deploy it with cordova, svg icons don't display from androids. You can see the behavior below :

running game with chromium

running game with android emulator

.fill-diamond {
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-image: url('/out/nature/diamondStone.svg');
}

I realize when I write the svg's content directly in my css, the svg does display however my svg files are quite heavy so this is not a solution.

background-image: url('data:image/svg+xml;utf8,<svg>...</svg>');

After that investigation, I suspect that css is not authorised to load external files (but I may be wrong), so I try to give rights with the android Manifest file and config.xml of cordova, unfortunately I did not succeed.

config.xml

 <?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.program6" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Program 6</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" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <allow-navigation href="*" />
    <access origin="*" />
    <allow-intent href="*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
</widget>

androidManifest.xml

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="com.example.program6" 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" />
    <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config" android:supportsRtl="true" android:usesCleartextTraffic="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" 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>
    <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</manifest>

user1108459

Posted 2019-11-02T12:01:01.993

Reputation: 1

Use Remote WebView Debugging to find out what is going wrong.

– Robert – 2019-11-02T12:08:18.750

No answers