快连安卓版图标怎么设置如何在Fastlane中设置安卓版图标

快连加速器 0 2401

1、准备工作

- 1.1图标文件:你需要准备多个不同尺寸的图标文件,包括:

mdpi(48x48像素)

hdpi(72x72像素)

xhdpi(96x96像素)

xxhdpi(144x144像素)

xxxhdpi(192x192像素)

- 你可以从Google Material Design Icons库下载这些图标文件。

- 1.2图标路径:将这些图标文件放在项目的fastlane/resources/icons目录下,如果你的应用名为MyApp,图标文件应该放在fastlane/resources/icons/MyApp子目录中。

2、编辑Fastfile

   fastlane/fastlane.rb
   default_platform :android
   platform :android do
     before_all do |lane|
       # 设置图标路径
       Fastlane::Utils.augment_lanes(:android) do |lane|
         lane.tap do |options|
           options[:app_icon_path] = 'fastlane/resources/icons/MyApp'
         end
       end
     end
     desc "Upload the app to Google Play"
     lane :google_play_upload do
       upload_to_google_play(
         track: 'alpha',
         package_name: 'com.example.myapp',
         metadata_file: 'fastlane/metadata/google-play.json',
         ios_metadata_file: 'fastlane/metadata/ios.json'
       )
     end
   end

3、创建metadata文件

- 3.1google-play.json

在项目根目录下创建fastlane/metadata/google-play.json文件,并添加以下内容:

     {
       "applicationId": "com.example.myapp",
       "versionCode": 1,
       "versionName": "1.0.0",
       "iconUrl": "https://example.com/icon-mdpi.png",
       "screenshots": [
         {
           "url": "https://example.com/screenshot-hdpi.png"
         },
         {
           "url": "https://example.com/screenshot-xhdpi.png"
         },
         {
           "url": "https://example.com/screenshot-xxhdpi.png"
         },
         {
           "url": "https://example.com/screenshot-xxxhdpi.png"
         }
       ],
       "category": "PRODUCTIVITY",
       "keywords": ["MyApp", "productivity"],
       "developerName": "Your Name",
       "privacyPolicyUrl": "https://example.com/privacy-policy.html",
       "contactEmail": "your.email@example.com",
       "playStoreUrl": "https://play.google.com/store/apps/details?id=com.example.myapp",
       "supportEmail": "support@yourdomain.com",
       "storeListingDescription": "A high-performance productivity app.",
       "minimumSdkVersion": 21,
       "targetSdkVersion": 30,
       "usesCleartextTraffic": false,
       "usesGCM": false,
       "usesLocation": true,
       "usesBluetooth": false,
       "usesCamera": false,
       "usesFineLocation": true,
       "usesCoarseLocation": true,
       "usesExternalStorage": false,
       "usesSensors": false,
       "usesPersonalInformation": false,
       "usesThirdPartyLibraries": false
     }

- 3.2ios-metadata.json

在项目根目录下创建fastlane/metadata/ios.json文件,并添加以下内容:

     {
       "bundleIdentifier": "com.example.myapp",
       "displayName": "MyApp",
       "shortVersionString": "1.0.0",
       "version": "1.0.0",
       "platforms": [
         "ios"
       ],
       "deploymentTarget": "13.0",
       "informationPropertyList": {
         "NSPhotoLibraryUsageDescription": "Allow MyApp to access your photos and videos."
       }
     }

4、运行Fastlane命令

   fastlane android google_play_upload

Fastlane会自动找到fastlane/resources/icons目录下的所有图标文件,并根据它们的尺寸生成相应的资源文件,它会将这些资源文件与google-play.jsonios-metadata.json一起上传到Google Play,这样可以提高用户对你的应用的好感度和下载量。

相关推荐: