2017-10-31 29 views
6

Chúng tôi đã có một ứng dụng web được hỗ trợ bởi cordova để tạo ra các ứng dụng di động. Mọi thứ đều hoạt động trên iOS.Cordova ứng dụng android không hiển thị biểu tượng trên màn hình chính

Chúng tôi đang cố gắng thêm nền tảng Android và mọi thứ hoạt động tốt ngoại trừ biểu tượng ứng dụng.

Các config.xml chủ yếu sau những gì on the docs:

<widget 
    id="xxx" 
    version="xxx" 
    ios-CFBundleVersion="xxx" 
    xmlns="http://www.w3.org/ns/widgets" 
    xmlns:cdv="http://cordova.apache.org/ns/1.0" 
> 
    <name>xxx</name> 
    <description></description> 
    <author email="xxx" href="xxx">xxx</author> 
    <content src="index.html" /> 

    <engine name="ios" spec="~4.5.1" /> 
    <engine name="android" spec="~6.3.0" /> 

    <platform name="ios"> 
     <allow-intent href="itms:*" /> 
     <allow-intent href="itms-apps:*" /> 
     <preference name="BackupWebStorage" value="none" /> 
     <preference name="deployment-target" value="8.0" /> 
     <preference name="KeyboardDisplayRequiresUserAction" value="false" /> 
     <preference name="UIWebViewDecelerationSpeed" value="normal" /> 

     <icon src="resources/icons/Icon-Small.png" width="29" height="29" /> 
     <icon src="resources/icons/[email protected]" width="58" height="58" /> 
     <icon src="resources/icons/[email protected]" width="87" height="87" /> 
     <icon src="resources/icons/Icon-40.png" width="40" height="40" /> 
     <icon src="resources/icons/Icon-50.png" width="50" height="50" /> 
     <icon src="resources/icons/[email protected]" width="100" height="100" /> 
     <icon src="resources/icons/Icon.png" width="57" height="57" /> 
     <icon src="resources/icons/[email protected]" width="114" height="114" /> 
     <icon src="resources/icons/Icon-40[email protected]" width="80" height="80" /> 
     <icon src="resources/icons/[email protected]" width="120" height="120" /> 
     <icon src="resources/icons/Icon-60.png" width="60" height="60" /> 
     <icon src="resources/icons/[email protected]" width="120" height="120" /> 
     <icon src="resources/icons/[email protected]" width="180" height="180" /> 
     <icon src="resources/icons/Icon-72.png" width="72" height="72" /> 
     <icon src="resources/icons/[email protected]" width="144" height="144" /> 
     <icon src="resources/icons/Icon-76.png" width="76" height="76" /> 
     <icon src="resources/icons/[email protected]" width="152" height="152" /> 
     <icon src="resources/icons/Icon-83.5.png" width="83.5" height="83.5" /> 
     <icon src="resources/icons/[email protected]" width="167" height="167" /> 
     <icon src="resources/icons/[email protected]" width="1024" height="1024" /> 

     <preference name="ShowSplashScreenSpinner" value="false"/> 

     <splash src="resources/splash/[email protected]~universal~anyany.png" width="2732" height="2732"/> 
    </platform> 

    <platform name="android"> 
     <allow-intent href="market:*" /> 

     <icon src="resources/icons/ldpi.png" density="ldpi" /> 
     <icon src="resources/icons/mdpi.png" density="mdpi" /> 
     <icon src="resources/icons/hdpi.png" density="hdpi" /> 
     <icon src="resources/icons/xhdpi.png" density="xhdpi" /> 
     <icon src="resources/icons/xxhdpi.png" density="xxhdpi" /> 
     <icon src="resources/icons/xxxhdpi.png" density="xxxhdpi" /> 

     <splash src="resources/splash/splash-land-hdpi.png" density="land-hdpi"/> 
     <splash src="resources/splash/splash-land-ldpi.png" density="land-ldpi"/> 
     <splash src="resources/splash/splash-land-mdpi.png" density="land-mdpi"/> 
     <splash src="resources/splash/splash-land-xhdpi.png" density="land-xhdpi"/> 
     <splash src="resources/splash/splash-port-hdpi.png" density="port-hdpi"/> 
     <splash src="resources/splash/splash-port-ldpi.png" density="port-ldpi"/> 
     <splash src="resources/splash/splash-port-mdpi.png" density="port-mdpi"/> 
     <splash src="resources/splash/splash-port-xhdpi.png" density="port-xhdpi"/> 

     <preference name="AndroidPersistentFileLocation" value="Compatibility" /> 
    </platform> 

    <plugin name="cordova-plugin-whitelist" spec="1" /> 
    <access origin="*" /> 
    <allow-intent href="http://*/*" /> 
    <allow-intent href="https://*/*" /> 
    <allow-navigation href="https://*/*" /> 
    <allow-intent href="mailto:*" /> 
    <allow-navigation href="mailto:*" /> 

    <universal-links> 
     <ios-team-id value="xxx" /> 
     <host name="$host" scheme="$scheme" event="universal-link-clicked"/> 
    </universal-links> 

    <plugin name="cordova-plugin-file-transfer" spec="~1.6.2" /> 
    <plugin name="cordova-plugin-file" spec="~4.3.3" /> 
    <plugin name="cordova-plugin-network-information" spec="~1.3.2" /> 
    <plugin name="cordova-plugin-statusbar" spec="~2.2.2" /> 
    <plugin name="cordova-plugin-background-fetch" spec="https://github.com/christocracy/cordova-plugin-background-fetch.git" /> 
    <plugin name="cordova-plugin-inappbrowser" spec="~1.7.0" /> 
    <plugin name="cordova-plugin-disable-bitcode" spec="~1.3.2" /> 
    <plugin name="com.batch.cordova" spec="https://github.com/floo51/cordova-plugin.git" /> 
    <plugin name="cordova-plugin-splashscreen" spec="~4.0.2" /> 
    <plugin name="cordova-plugin-ios-non-exempt-encryption" spec="~1.0.0" /> 
    <plugin name="cordova-universal-links-plugin" spec="~1.2.1" /> 
</widget> 

Có nhiều loại khác nhau của các biểu tượng:

  • tập tin APK biểu tượng (hoạt động)
  • Cài đặt màn hình (hoạt động)
  • menu Ứng dụng (không hoạt động)
  • H ome màn hình (không hoạt động) enter image description here

  • Runnings ứng dụng (không hoạt động) enter image description here

lạ nhất là rằng nó làm việc trên mô phỏng (mối quan hệ 5) nhưng không phải trên một OnePlus Một hoặc một chiếc Moto G4.

Chúng tôi đang sử dụng cordova 6.5. Tất cả các biểu tượng được thay đổi kích thước theo what's on the docs. Chúng tôi đã bỏ lỡ bất cứ điều gì?

+0

Vâng vào biểu tượng làm việc nhưng một trong những mặc định của nó mà chỉ một cái gì đó là sai hoặc với thư mục 'resources' hoặc với thư mục' platforms' của bạn. Bạn nên kiểm tra xem thư mục 'resources' có chứa mọi kích thước của biểu tượng của bạn không và sửa các vấn đề như thế bạn thường readd nền tảng android sau khi xóa thư mục' platforms' bằng cách chạy 'cordova platform add android @ latest'. Bạn cũng nên cân nhắc nâng cấp từ cordova 6.5 lên phiên bản mới nhất. – David

Trả lời

2

Tôi khuyên bạn nên hai điều:

1) Sử dụng qualifier thay vì density. Ví dụ:

<icon src="resources/icons/ldpi.png" qualifier="ldpi" /> 

2) Thêm biểu tượng mặc định & giật gân như một dự phòng trong thư mục gốc của dự án của bạn:

<icon src="icon.png" /> 
<splash src="splash.png" /> 
+2

Wow! 'vòng loại' thực sự khắc phục vấn đề ... Sẽ cần một số cập nhật tài liệu. Cảm ơn ! –

Các vấn đề liên quan